The final ticket price is calculated by adding the extra charges and service charges to the base price, and then subtracting the discount.
Inside the body of the last if statement, below the print('Service charges:', service_charges) line, calculate the final price of the ticket and store it in a variable named final_price.
Finally, print a message that shows Final price of ticket: followed by the value of final_price.
distance_mi=9
is_raining=True
has_bike=True
has_car=True
has_ride_share_app=True
if distance_mi=False:
print('False')
if distance_mi<=1:
elif not is_raining:
print('true')
else:
print('False')
if distance_mi>1 and distance_mi<=6:
elif has_bike and not is_raining:
print('true')
else:
print('false')
if distance_mi>6:
elif has_car or has_ride_share_app:
print('True')
else:
print('False')
If distance_mi is 0, what do you see in the console?
I’ve edited your post to improve the readability of the code. When you enter a code block into a forum post, please precede it with three backticks to make it easier to read.
You can also use the “preformatted text” tool in the editor (</>) to add the backticks.