Hi FCC! I am a VERY new Python programmer. The code below quits after I imput 1 or 2 during the prompt under the “first_shot” function. For some reason, the code after first_shot, including second_shot and the “Game Over” text.
The error in my IDE says NameError: shot1 not defined
import random
import time
score = 0
def print_pause(message):
print(message)
time.sleep(2)
def intro():
print_pause("Welcome to Brittany's Putt-Putt world!")
print_pause("The Putt-Putt adventure of a lifetime awaits you.")
print_pause("You are on Hole #1, a Par 3.")
print_pause("""You see a narrow bridge that goes over the river, or a wide fairway that goes around.""")
def first_shot():
print_pause(""""Would you like to try to go over the bridge, or take the wide fairway?""")
shot1 = input("Press 1 for the Bridge Press 2 for the Fairway ")
#can't figure out why this will not print. After 1 or 2 is input, the program closes.
def second_shot():
if shot1 == "1":
print_pause("You got over the bridge!")
print_pause("You made it into the fairway!")
def play_game():
intro()
first_shot()
second_shot()
print_pause("Game Over! See you next time.")
play_game()