-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlvl5.py
More file actions
28 lines (23 loc) · 713 Bytes
/
lvl5.py
File metadata and controls
28 lines (23 loc) · 713 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
import requests
params = {"nothing": "12345"}
while True:
flag = 0
r = requests.get(
"http://www.pythonchallenge.com/pc/def/linkedlist.php", params=params
)
n = len(r.text.split()) - 1
print(r.text)
# print(r.text.split()[n])
if flag == 1:
params["nothing"] = int(params["nothing"]) / 2
flag = 0
else:
params["nothing"] = r.text.split()[n]
flag = 0
if not params[
"nothing"
].isdigit(): # when we get this sentence: Yes. Divide by two and keep going.
flag = 1
if r.text == "peak.html": # final answer
break
# now visit http://www.pythonchallenge.com/pc/def/peak.html :)