Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

2. Write a Python script to test the function thoroughly using the years provided above. Part B - Problem Solving using Functions 1. Read the

image text in transcribed
image text in transcribed
2. Write a Python script to test the function thoroughly using the years provided above. Part B - Problem Solving using Functions 1. Read the problem description below: A 1000-ft cable is stretched between two towers with a supporting tower midway between two end towers. The velocity of the cable car depends on its position on the cable. When the cable car is within 30 feet of a tower, its velocity is: Velocity = 2.425 + 0.00175d2 ft/sec where d is the distance in feet from the cable car to the nearest tower. If the cable car is not within 30 feet of a tower, its velocity is: Velocity = 0.625 + 0.120 -0.00025dft/sec 2. Open cablecar.py. Add the following functions to this Python script so that it correctly determines the velocity of the car at the location specified by the user: a. A function to return the distance to the nearest tower b. A function to compute and return the velocity of the cable car at a specified point on the cable. cablecar.py Download cablecar.py (1.36 KB) This script determines the velocity of a cable car that is on a 1000ft cable supported by three towers (one at each end and one in the siddle). when the cable car is within 30ft of a tower its velocity - 2.425 +0.00175" 2 ft/sec, where d 15 the closest distance from the car to a tower. When the cable carts NOT within 30ft of a tower its velocity = 0.625 + 0.120 - 0.00025d 2 ft/sec. #This function returns the distance to the nearest tower. It has one parameter dist (distance from tower 1) def distance_to_nearest_tower(dist): print("The distance_to_nearest tower function must be implemented by CMPSC 131 students") return 42 This function computes and returns velocity based on its parameter d which is distance to nearest tower def velocityd) print "The velocity function must be implemented by CMPSC 131 students") return 42.5 print This program simulates a cable car traveling along a 1000ft cable.") print("Its velocity is determined by its location relative to one of three towers. #distance represents the distance between the cable car and the first tower distance = int(input("What is the distance in ft between the cable car and tower 17 ")) nearest - distance_to_nearest tower (distance) V velocity(nearest) print("The velocity of the cable car at distance,"it is".v. ft/sec.)

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

OCA Oracle Database SQL Exam Guide Exam 1Z0-071

Authors: Steve O'Hearn

1st Edition

1259585492, 978-1259585494

More Books

Students also viewed these Databases questions

Question

=+What is your birthday? (often on application forms) Disability

Answered: 1 week ago