correct this print("Total tax for your %.2f is " %income %total_tax)
- User
correct this print("Total tax for your %.2f is " %income %total_tax)
- Assistant
print("Total tax for your %.2f is %.2f" %(income, total_tax))
- User
Fix the code
floor = int(input("Enter the floor number you would like to reach: "))
Make sure the user input is valid and ask for the input again
if floor <= 0 or floor > 20: print("The floor must be between 1 and 20.") elif floor == 13: print("Error: There is no thirteenth floor") floor = int(input("Enter the floor number you would like to reach: "))
if floor > 13: actual_floor = floor - 1 print("The elevator will travel to the actual floor ", actual_floor) else: actual_floor = floor print("The elevator will travel to the actual floor ", actual_floor)
- Assistant
Asking the user for the floor number
floor = int(input("Enter the floor number you would like to reach: "))
Validating the user input and asking again if invalid
while floor <= 0 or floor > 20: print("The floor must be between 1 and 20.") floor = int(input("Enter the floor number you would like to reach: "))
Checking if the floor is the 13th floor
if floor == 13: print("Error: There is no thirteenth floor") floor = int(input("Enter the floor number you would like to reach: "))
Determining the actual floor the elevator will travel to
if floor > 13: actual_floor = floor - 1 print("The elevator will travel to the actual floor", actual_floor) else: actual_floor = floor print("The elevator will travel to the actual floor", actual_floor)