# 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
while True:
familar_name = input("what is a common name")
print("hello", familar_name)
break
# [ ] 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
shirt_count = 0
S = 0
M = 0
L = 0
num_sizes = 15
while True:
shirt_type = input('enter the type of shirt you want "small", "medium" or large" then type "exit" when your finished')
if shirt_type.lower().startswith("e"):
print()
break
elif shirt_type.lower() == "small":
S += 1
elif shirt_type.lower() == "medium":
M += 1
elif shirt_type.lower() == "large":
L += 1
else:
print("invalid entry: counted as medium")
M += 1
shirt_count += 1
if shirt_count >= num_sizes:
print("\nYou are asking for more than we have")
break
print(shirt_count, "Shirts total: ", S ,"small", M, "medium", L, "large")
# [ ] Create the Shirt Register Challenge program, run tests
shirt_count = 0
S = 0
M = 0
L = 0
num_sizes = 15
while True:
shirt_type = input('enter the type of shirt you want "small", "medium" or large" then type "exit" when your finished')
if shirt_type.lower().startswith("e"):
print()
break
elif shirt_type.lower() == "small":
S += 6
elif shirt_type.lower() == "medium":
M += 7
elif shirt_type.lower() == "large":
L += 8
else:
print("invalid entry: counted as medium")
M += 1
shirt_count += 1
if shirt_count >= num_sizes:
print("\nYou are asking for more than we have")
break
total_price = M + S + L
print(total_price, "Price total: ","$",S,"small","$",M, "medium","$",L, "large")