'F' → Fullscreen
Create a new Python program named 1-11-if-elif-else.
elif chain.import random
print("--- Chinese Zodiac Calendar ---")
birth_year = int(input("Enter your birth year: "))zodiac_number = birth_year % 12zodiac_animal = "" # Assign animal based on birth year
if zodiac_number == 0: zodiac_animal = "monkey"elif zodiac_number == 1: zodiac_animal = "rooster"elif zodiac_number == 2: zodiac_animal = "dog"elif zodiac_number == 3: zodiac_animal = "pig"elif zodiac_number == 4: zodiac_animal = "rat"elif zodiac_number == 5: zodiac_animal = "ox"elif zodiac_number == 6: zodiac_animal = "tiger"elif zodiac_number == 7: zodiac_animal = "rabbit"elif zodiac_number == 8: zodiac_animal = "dragon"elif zodiac_number == 9: zodiac_animal = "snake"elif zodiac_number == 10: zodiac_animal = "horse"else: zodiac_animal = "sheep"
print(f"Birth year: {birth_year} - You are the year of the...{zodiac_animal}.")input("Press enter to continue...")random module to generate two winning numbers.elif.import random
print("--- Chinese Zodiac Calendar ---")
birth_year = int(input("Enter your birth year: "))zodiac_number = birth_year % 12zodiac_animal = "" # Assign animal based on birth year
if zodiac_number == 0: zodiac_animal = "monkey"elif zodiac_number == 1: zodiac_animal = "rooster"elif zodiac_number == 2: zodiac_animal = "dog"elif zodiac_number == 3: zodiac_animal = "pig"elif zodiac_number == 4: zodiac_animal = "rat"elif zodiac_number == 5: zodiac_animal = "ox"elif zodiac_number == 6: zodiac_animal = "tiger"elif zodiac_number == 7: zodiac_animal = "rabbit"elif zodiac_number == 8: zodiac_animal = "dragon"elif zodiac_number == 9: zodiac_animal = "snake"elif zodiac_number == 10: zodiac_animal = "horse"else: zodiac_animal = "sheep"
print(f"Birth year: {birth_year} - You are the year of the...{zodiac_animal}.")input("Press enter to continue...")
print("--- Lottery Game ---")print("Rules: Pick two lottery numbers ranging from 0 to 9")print("Match two numbers and win BIG!")print("Match one number in order and win SMALL!")
lotto_num_1 = int(input("Enter your 1st lottery number (0 to 9): "))lotto_num_2 = int(input("Enter your 2nd lottery number (0 to 9): "))winning_num_1 = random.randint(0, 9)winning_num_2 = random.randint(0, 9)
# Exit the program if either lotto number is out of rangeif lotto_num_1 < 0 or lotto_num_1 > 9 or lotto_num_2 < 0 or lotto_num_2 > 9: print("Error: Your lotto numbers are invalid. Exiting") exit()
print(f"The winning numbers are {winning_num_1} and {winning_num_2}!")
if lotto_num_1 == winning_num_1 and lotto_num_2 == winning_num_2: print("You win BIG!")elif lotto_num_1 == winning_num_1 or lotto_num_2 == winning_num_2: print("You win SMALL!")else: print("You lose! Better luck next time!")Verify your program works correctly.
--- Chinese Zodiac Calendar ---Enter your birth year: 1990 [Enter]Birth year: 1990 - You are the year of the...horse.Press enter to continue...--- Lottery Game ---Rules: Pick two lottery numbers ranging from 0 to 9Match two numbers and win BIG!Match one number in order and win SMALL!Enter your 1st lottery number (0 to 9): 2 [Enter]Enter your 2nd lottery number (0 to 9): 4 [Enter]The winning numbers are 2 and 6!You win SMALL!Answer the following questions before submitting your work.
if/elif/else chain, how many of the blocks can run at most?elif zodiac_number == 11: check before its else?random here similar to importing math back in Activity 1.9?Submit the required files to the appropriate dropbox.