Question
python3 (2) Min and max weights on bridges (a) There is a single road between two cities. The road has three bridges with weight limits
python3
(2) Min and max weights on bridges
(a) There is a single road between two cities. The road has three bridges with weight limits a, b, c, as shown in the picture below: To drive along the route, your truck needs to drive first over the bridge with weight limit a, then the one with weight limit b, then the one with weight limit c. Your truck will crash if you overload any of the three weight limits. Write a function, max_trans1, that prints the maximum weight that can be transported along this road. Your function should take the values of a, b, and c as input. (That is, a, b, and c will be function parameters.) max_trans1 will return the value None (end of the function, type return None).
Test max_trans1 as follows:
>>> max_trans1(1, 2, 3)
1
>>> max_trans1(9, 6, 3)
3
>>> max_trans1(0, 0, 0)
0
(2)(b) There is also a second route consisting of two bridges, the first with weight limit d, and the second with weight limit e, as illustrated: Your truck can take either route. Write a function, max_trans2, that prints the maximum weight that can be transported between the two cities. Your function should take the values of a, b, c, d, and e as input. max_trans2 will return the value None (end of the function, type return None).
Test max_trans2 as follows:
>>> max_trans2(1, 2, 3, 4, 5)
4
>>> max_trans2(222, 110, 411, 54, 73)
110
>>> max_trans2(0, 0, 0, 0, 0)
0
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started