-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathcode50.py
More file actions
executable file
·46 lines (34 loc) · 1.09 KB
/
code50.py
File metadata and controls
executable file
·46 lines (34 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import socket
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(('188.166.133.53',11027))
data = s.recv(2048)
print data
data = s.recv(2048)
question = data.split(' ')
print question
if question[3] == "-":
s.send(str(int(question[4]) + int(question[6])) + "\n")
elif question[3] == "+":
s.send(str(int(question[6]) - int(question[4])) + "\n")
elif question[3] == "*":
s.send(str(int(question[6]) / int(question[4])) + "\n")
elif question[3] == "/":
s.send(str(int(question[6]) * int(question[4])) + "\n")
for x in range(0, 200):
data = s.recv(19)
print data
data = s.recv(512)
question = data.split(' ')
print question
if question[3] == "-":
s.send(str(int(question[4]) + int(question[6])) + "\n")
elif question[3] == "+":
s.send(str(int(question[6]) - int(question[4])) + "\n")
elif question[3] == "*":
s.send(str(int(question[6]) / int(question[4])) + "\n")
elif question[3] == "/":
s.send(str(int(question[6]) * int(question[4])) + "\n")
data = s.recv(2048)
print data
#s.send(str(20) + "\n")
s.close()