done is a Boolean variable and True is the sentinel value.
Add code for the Intro menu item when the user selects I.
Using a while loop, print your name 5 times.
intro.py
done =Falsewhilenot done:print("Menu")print("I - Intro")print("Q - Quit") choice =input("Choice: ")if choice =="I":print("Introductory Problem") x =0 name =input("What's your name? ")while x <5:print(name)elif choice =="Q":print("Exiting Menu!") done =True
for loop
Previously, you used while loops to iterate over a range of integer values. Now you will use a for loop with the range function with one argument.
Programmers usexorias a stepper variable.
Examples
Example 1
Add a Menu Item E1 - Example 1
Using a for loop, print your name 5 times.
example1.py
done =Falsewhilenot done:print("Menu")print("I - Intro")print("Q - Quit") choice =input("Choice: ")if choice =="I":print("Introductory Problem") x =0 name =input("What's your name? ")while x <5:print(name)elif choice =="Q":print("Exiting Menu!") done =Trueelif choice =="E1":print("Example 1") name =input("What is your name? ")for i inrange(5):print(name)