# File: followerGuess.py # Author: Prof. Neary # Date: 9/20/2018 # Section: N/A # E-mail: michael.neary@umbc.edu # Description: # This file is a simple guessing game with Prof. Neary's Twitter # followers. It lets you know if the user was too high, too low, # or if they got the follolwers correct. It has been updated to # continue playing untilt he user gets the number right. FOLLOWERS = 380 def main(): # 1. Get their first guess to "prime" the loop guess = int(input("Enter a guess: ")) #2. So long as their guess is incorrect while guess != FOLLOWERS: #2a. Tell the user whether or not their guess was high or low if guess > FOLLOWERS: print("You were too high!") elif guess < FOLLOWERS: print("You were too low!") #2b. Get the next guess from the user, and repeat step 2 guess = int(input("Enter a guess: ")) #3. When the loop is done, you know they have entered the right guess print("Correct!!!") main()