-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsortclient.py
More file actions
29 lines (26 loc) · 778 Bytes
/
sortclient.py
File metadata and controls
29 lines (26 loc) · 778 Bytes
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
import socket, sys, json
s = socket.socket()
host = socket.gethostname()
port = 1519
s.connect((host, port))
while True:
ele = int(input("\nEnter the Number of elements : " ))
print("\nEnter the elements : ")
List_a= [int(input()) for i in range(ele)]
print("\nArray entered is : ")
print(List_a)
data = json.dumps({"a": List_a, "b": ele})
s.send(data.encode())
res = s.recv(1024)
res = json.loads(res)
asc = res.get("List_asc")
dsc = res.get("List_dsc")
print("\nAscending order : ")
print(asc)
print("\ndescending order : ")
print(dsc)
x = input('\nDo you want to continue (Y/N to end):')
if (x=='n' or x=='N') :
break
print("\n-------------- SORT ANOTHER ARRAY --------------")
s.close()