forked from pi515jd/project1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
34 lines (28 loc) · 845 Bytes
/
main.py
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
30
31
32
33
34
# Copyright 2022 PI515
import random
while True:
keepAsking == True
while keepAsking:
num = input(Type a number for an upper bound: )
if num.isdigit():
print("Let's play!")
num = int(num)
# something about the loop condition
else:
print("Invalid input. Try again.")
secret = random.randint(1, num)
guess = None
counter = 1
while guess != secret:
guess = input("Type a number between 1 and " str(num) ": ")
if guess.isdigit():
guess = int(guess)
if False: # can't always be wrong
print("You got it!")
else:
print("Try again.")
# what else?
if count == 1
print("It took you", count, "guess!")
else:
print("It took you", count, "guesses!")