feat: add guess number
This commit is contained in:
16
guess_number.py
Normal file
16
guess_number.py
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
import random
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
num = random.randint(1,100)
|
||||||
|
while True:
|
||||||
|
n = int(input('Input a number:'))
|
||||||
|
if n == num:
|
||||||
|
print(f'Found it, the number is: {num}')
|
||||||
|
exit(0)
|
||||||
|
elif n < num:
|
||||||
|
print('Less than the number')
|
||||||
|
else:
|
||||||
|
print('Greater than the number')
|
||||||
|
|
||||||
Reference in New Issue
Block a user