Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
5
Task/Guess-the-number/Python/guess-the-number-1.py
Normal file
5
Task/Guess-the-number/Python/guess-the-number-1.py
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
import random
|
||||
t,g=random.randint(1,10),0
|
||||
g=int(input("Guess a number that's between 1 and 10: "))
|
||||
while t!=g:g=int(input("Guess again! "))
|
||||
print("That's right!")
|
||||
24
Task/Guess-the-number/Python/guess-the-number-2.py
Normal file
24
Task/Guess-the-number/Python/guess-the-number-2.py
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
import random #milliard.py
|
||||
h1 = 0; h2 = 10**16; t = 0; f=0
|
||||
c = random.randrange(0,h2) #comp
|
||||
h = random.randrange(0,h2) #human DANILIN
|
||||
|
||||
while f<1:
|
||||
print(t,c,h)
|
||||
|
||||
if h<c:
|
||||
print('MORE')
|
||||
a=h
|
||||
h=int((h+h2)/2)
|
||||
h1=a
|
||||
|
||||
elif h>c:
|
||||
print('less')
|
||||
a=h
|
||||
h=int((h1+h)/2)
|
||||
h2=a
|
||||
|
||||
else:
|
||||
print('win by', t, 'steps')
|
||||
f=1
|
||||
t=t+1
|
||||
Loading…
Add table
Add a link
Reference in a new issue