At Westonci.ca, we provide reliable answers to your questions from a community of experts. Start exploring today! Join our platform to connect with experts ready to provide accurate answers to your questions in various fields. Discover in-depth answers to your questions from a wide network of professionals on our user-friendly Q&A platform.
Sagot :
The toll program illustrates the use of conditional statements;
As a general rule, conditional statements are used to make decisions
The toll program
The toll program written in Python where conditional statements are used to make several decisions is as follows:
def calc_toll(hour, morning, weekend):
toll_fee = 0
if weekend == False:
if morning == True:
if hour < 7:
toll_fee+=1.15
elif hour < 10:
toll_fee+=2.95
elif hour <= 12:
toll_fee+=1.90
else:
if hour < 3:
toll_fee+=1.90
elif hour < 8:
toll_fee+=3.95
elif hour >= 8:
toll_fee+=1.40
else:
if morning == True:
if hour < 7:
toll_fee+=1.05
elif hour <= 12:
toll_fee+=2.15
else:
if hour < 8:
toll_fee+=2.15
elif hour >= 8:
toll_fee+=1.10
return toll_fee
Read more about conditional statements at:
https://brainly.com/question/24833629
#SPJ1
Thanks for using our service. We're always here to provide accurate and up-to-date answers to all your queries. Thank you for choosing our platform. We're dedicated to providing the best answers for all your questions. Visit us again. Thank you for trusting Westonci.ca. Don't forget to revisit us for more accurate and insightful answers.