Merge branch 'master' of git://github.com/gerroo/Python · matrixji/Python@485f93f · GitHub
Skip to content

Commit 485f93f

Browse files
committed
Merge branch 'master' of git://github.com/gerroo/Python
2 parents 432c62d + 5492681 commit 485f93f

8 files changed

Lines changed: 91 additions & 35 deletions

File tree

Maths/3n+1.py

Lines changed: 18 additions & 0 deletions

Maths/FindMin.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
def main():
2+
def findMin(x):
3+
minNum = x[0]
4+
for i in x:
5+
if minNum > i:
6+
minNum = i
7+
return minNum
8+
9+
print(findMin([0,1,2,3,4,5,-3,24,-56])) # = -56
10+
11+
if __name__ == '__main__':
12+
main()

ciphers/base64_cipher.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import base64
2+
3+
def main():
4+
inp = input('->')
5+
encoded = inp.encode('utf-8') #encoded the input (we need a bytes like object)
6+
b64encoded = base64.b64encode(encoded) #b64encoded the encoded string
7+
print(b64encoded)
8+
print(base64.b64decode(b64encoded).decode('utf-8'))#decoded it
9+
10+
if __name__ == '__main__':
11+
main()
File renamed without changes.

simple_client/client.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# client.py
2+
3+
import socket
4+
5+
HOST, PORT = '127.0.0.1', 1400
6+
7+
s = socket.socket(
8+
9+
socket.AF_INET, # ADDRESS FAMILIES
10+
#Name Purpose
11+
#AF_UNIX, AF_LOCAL Local communication
12+
#AF_INET IPv4 Internet protocols
13+
#AF_INET6 IPv6 Internet protocols
14+
#AF_APPLETALK Appletalk
15+
#AF_BLUETOOTH Bluetooth
16+
17+
18+
socket.SOCK_STREAM # SOCKET TYPES
19+
#Name Way of Interaction
20+
#SOCK_STREAM TCP
21+
#SOCK_DGRAM UDP
22+
)
23+
s.connect((HOST, PORT))
24+
25+
s.send('Hello World'.encode('ascii'))#in UDP use sendto()
26+
data = s.recv(1024)#in UDP use recvfrom()
27+
28+
s.close()#end the connection
29+
print(repr(data.decode('ascii')))

simple_client/server.py

Lines changed: 21 additions & 0 deletions

simple_client_server/client.py

Lines changed: 0 additions & 14 deletions
This file was deleted.

simple_client_server/server.py

Lines changed: 0 additions & 21 deletions
This file was deleted.

0 commit comments

Comments
 (0)