-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFirstOrder.py
More file actions
26 lines (24 loc) · 878 Bytes
/
FirstOrder.py
File metadata and controls
26 lines (24 loc) · 878 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
import requests
response = requests.get(
"https://zvlhch4ygd.execute-api.eu-west-1.amazonaws.com/production/challenge")
SplittedResponse = response.text.split('-->')
exec("liste = " + SplittedResponse[0])
#print(liste)
numericalOrder = []
alphapeticalOrder = []
for i in liste:
if i.isnumeric():
numericalOrder.append(int(i))
else:
alphapeticalOrder.append(i)
numericalOrder = sorted(numericalOrder)
alphapeticalOrder = sorted(alphapeticalOrder)
FinalSortedList = ""
if SplittedResponse[1].split(' ')[0] == 'Words':
FinalSortedList = alphapeticalOrder + numericalOrder
else:
FinalSortedList = numericalOrder + alphapeticalOrder
print(FinalSortedList)
response = requests.post("https://zvlhch4ygd.execute-api.eu-west-1.amazonaws.com/production/challenge",
json={'answer': str(FinalSortedList)})
print(response.text)