"""
guessing game design
Sally CS Major
Spring 2020
"""
from random import *
def main():
print_intro()
answer = randrange(1,101)
# for debugging/testing...will delete later
print(answer)
nguesses = 0
done = False
while not done:
nguesses = nguesses + 1
guess = get_int(nguesses)
if guess == answer:
print("Correct!!")
done = True
elif guess > answer:
print("Nope...too high.")
else:
print("Nope...too low")
final_message(nguesses)
def print_intro():
"""
Inputs: None
Returns: None
Purpose: To print an introduction to the user.
"""
print("In print_intro")
def get_int(nguesses):
"""
Inputs: which guess we are on
Returns: integer guessed by user
Purpose: get integer from user, make sure it's valid (1-100)
"""
print("In get_int")
# still need to do validation of input
n = int(input("your guess: "))
return n
def final_message(nguesses):
"""
Inputs: number of guesses it took
Returns: None
Purpose: display message based on how many guesses it took
"""
print("In final_message")
main()