/ pset4 / game / game.py
game.py
 1  import random
 2  
 3  while True:
 4      try:
 5          up = int(input("Level: "))
 6      except ValueError:
 7          continue
 8      if up < 1:
 9          continue
10      else:
11          break
12  rand = random.randint(1, up)
13  
14  while True:
15      try:
16          guess = int(input("Guess: "))
17      except ValueError:
18          continue
19      if guess < rand:
20          print("Too small!")
21          continue
22      elif guess > rand:
23          print("Too large!")
24          continue
25      else:
26          print("Just right!")
27          break