# Review and run code
# this example never loops because the break has no conditions
while True:
print('write forever, unless there is a "break"')
break
# [ ] review the NUMBER GUESS code then run - Q. what cause the break statement to run?
number_guess = "0"
secret_number = "5"
while True:
number_guess = input("guess the number 1 to 5: ")
if number_guess == secret_number:
print("Yes", number_guess,"is correct!\n")
break
else:
print(number_guess,"is incorrect\n")
# [ ] review WHAT TO WEAR code then run testing different inputs
while True:
weather = input("Enter weather (sunny, rainy, snowy, or quit): ")
print()
if weather.lower() == "sunny":
print("Wear a t-shirt and sunscreen")
break
elif weather.lower() == "rainy":
print("Bring an umbrella and boots")
break
elif weather.lower() == "snowy":
print("Wear a warm coat and hat")
break
elif weather.lower().startswith("q"):
print('"quit" detected, exiting')
break
else:
print("Sorry, not sure what to suggest for", weather +"\n")
# [ ] create Get Name program
familar_name=""
while True:
familar_name=input("Enter a familiar name")
if familar_name.isalpha():
print("Hello",familar_name)
break
else:
print("That isn't a name, try again.")
Hello Braeden
# [ ] review and run example
votes = 3
print(votes)
votes = votes + 1
print(votes)
votes += 2
print(votes)
print(votes)
votes -= 1
print(votes)
# [ ] review the SEAT COUNT code then run
seat_count = 0
while True:
print("seat count:",seat_count)
seat_count = seat_count + 1
if seat_count > 4:
break
# [ ] review the SEAT TYPE COUNT code then run entering: hard, soft, medium and exit
# initialize variables
seat_count = 0
soft_seats = 0
hard_seats = 0
num_seats = 4
# loops tallying seats using soft pads vs hard, until seats full or user "exits"
while True:
seat_type = input('enter seat type of "hard","soft" or "exit" (to finish): ')
if seat_type.lower().startswith("e"):
print()
break
elif seat_type.lower() == "hard":
hard_seats += 1
elif seat_type.lower() == "soft":
soft_seats += 1
else:
print("invalid entry: counted as hard")
hard_seats += 1
seat_count += 1
if seat_count >= num_seats:
print("\nseats are full")
break
print(seat_count,"Seats Total: ",hard_seats,"hard and",soft_seats,"soft" )
# [ ] Create the Shirt Count program, run tests
S=0
M=0
L=0
shirt_order=""
while True:
shirt_order=input("What size shirt would you like to order?\nEnter break to exit\Enter S, M, L:")
if shirt_order.upper()=="S":
S+=1
elif shirt_order.upper()=="M":
M+=1
elif shirt_order.upper()=="L":
L+=1
elif shirt_order=="exit":
print("You ordered",S,"smalls,",M,"mediums,","and",L,"large.")
break
else:
print("That isn't an available size.")
KeyboardInterrupt: Interrupted by user
# [ ] Create the Shirt Register program, run tests
S=0
M=0
L=0
shirt_order=""
while True:
shirt_order=input("What size shirt would you like to order?\nEnter break to exit\Enter S, M, L:")
if shirt_order.upper()=="S":
S+=1
elif shirt_order.upper()=="M":
M+=1
elif shirt_order.upper()=="L":
L+=1
elif shirt_order=="exit":
print("You ordered",S,"smalls,",M,"mediums,","and",L,"large.\nPlease pay $",S*6+M*7+L*8)
break
else:
print("That isn't an available size.")
That isn't an available size.
That isn't an available size.
KeyboardInterrupt: Interrupted by user