Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Chapter 4 Route Time Assume a route between two points has several segments. Each segment has a distance and estimated speed. Write a program to

Chapter 4
Route Time
Assume a route between two points has several segments. Each segment has a distance and estimated speed. Write a
program to determine the total time for the route. For this program, prompt the user for the number of segments, and then
use a for statement to loop over each segment, prompting the user for the distance and estimated speed for each segment,
and determining and displaying the total time.
Here is an example session:
Number of legs: 2
Enter leg 1 distance (miles): 30
Enter leg 1 speed (miles/hour): 60
Enter leg 2 distance (miles): 10
Enter leg 2 speed (miles/hour): 30
Total time (minutes): 50
Hint: Time = Distance/Speed
Chapter 5
Tuition
A college charges tuition according to the following:
12 or more credits: $20,000 for semester
1-11 credits: $1,200+$1,700 per credit
Write a program that prompts the user for a number of credits and determines and displays the tuition for the semester.
As part of your program, define and use a function with the signature:
def calcTuition(credits)
which returns the tuition for a given number of credits.
Hint:
if credits 12 :
result =20000
elif credits 1 :
result =1200+1700* credits
return result
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beginning Databases With PostgreSQL From Novice To Professional

Authors: Richard Stones, Neil Matthew

2nd Edition

1590594789, 978-1590594780

More Books

Students also viewed these Databases questions