def car_rental(): exceeded_period_invalid = True while exceeded_period_invalid: daily_rental_period_requested_is_invalid = True while daily_rental_period_requested_is_invalid: print() daily_rental_period = int(input("Enter the number of days requested: ")) print() if daily_rental_period < 0: print ("Please enter a number greater than 0: ") if daily_rental_period > 180: print ("The rental period exceed 180 days try a lower amount: ") else: daily_rental_period_requested_is_invalid = False weekly_rental_period_requested_is_invalid = True while weekly_rental_period_requested_is_invalid: print() weekly_rental_period = int(input("Enter the number of weeks requested: ")) print() if weekly_rental_period < 0: print ("Please enter a number greater than 0: ") if weekly_rental_period > 25: print ("The rental period exceed 180 days try a lower amount: ") else: weekly_rental_period_requested_is_invalid = False # Convert weeks in to days converted_weekly_rental_to_day = weekly_rental_period // 7 total_daily_rental_period = converted_weekly_rental_to_day + daily_rental_period # Add converted days to customer day input and check if total exceed 180 days total_rental_period = total_daily_rental_period + daily_rental_period if total_daily_rental_period > 180: print ("The rental period exceeded 180 days try a lower amount: ") exceeded_period_invalid = False #for debugging only print("exceeded period loop",exceeded_period_invalid,) print("daily invalid loop",daily_rental_period_requested_is_invalid) print("weekly invalid loop",weekly_rental_period_requested_is_invalid) car_rental()hi
i got a 1 main while loop, inside of it i have 2 while loops, it adds the result of the two inner and if it exceeds 180 days then the main loops runs again and ask the customer gain.
everything is fine untile you reach:
if total_daily_rental_period > 180: print ("The rental period exceeded 180 days try a lower amount: ") exceeded_period_invalid = False
it eihter ignores it or gets an error depending on indentation level
and cant use other python features, this professor is a moron.
