Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Solve this using Python! Solve this using Python! - Coding Problem 144 ( 6 points) Wree'se weleoen to go baek and eopy code fram frobles
Solve this using Python!
Solve this using Python!
- Coding Problem 144 ( 6 points) Wree'se weleoen to go baek and eopy code fram frobles 1 to do fahin problem, but you don't need to. Gimagine you're vriting the code tor an sirport ehnek-in kloak. pon cheek-in, it determinen how much a panenger ove: in - It the pansenger in not in elrst elann, then each bag costs the per-bag fee. The per-bag fee is typicany 530 , but may dden with some other value. - ie the panmenger is in firnt olash, their firat bag is tree, but their aecond bag costs the per-bag fee. - It the average veight of the gultcases exceedn 50 pounds. then the passenger is charged the overage fee for each bag. this applien to a $1 baga, regardiens of cabin. The overage write a function called calculate bag fee. calculate bag foe fshould have two positional parameter, the number of bags and the total woight of the bags, both integers. It should also have the following three keyword parameters. in this ordert - cabin, with a default value of 'Main'. - per bag fee, with a default value of 30 . - overage fee, with a default value of 40 . The function should return an integer representing the total. rbag tee. For example: calculate bag_fee (2,105)140 calculate bag_fee (2,105, cabin = "First") 110 calculate bag fee (2,95, per bag fee =50)180 calculate_bag_fee (2,105, overage_fee =80)220 Hdd your code here! *Below are some lines of code that will test your function. \#You can change the value of the variable(s) to test your \#function with different inputs. *If your function works correctly, this will originally *print: #140 \# 110 \# 100 \#220 print (calculate_bag_fee (2,105) ) print(calculate_bag_fee(2, 105, cabin = "First")) print (calculate_bag_fee (2,95, per bag fee =50) ) print (calculate_bag_fee (2,105, overage_fee =80) ) Coding Problem #4 (6 points) Finagine jou ire weiting the code tor an alrport oheck-in kiokk. Foneheck for thelit bags. To do so, it applien the following logict - It the pasaenger in not in firat clawn, then each bag cointa the per-bag fee. The permbatg fee in typiealiy 530 , but may - If the padmenger in in flrst olame, their firat bag in free. be overtidden with aote other value. but their wocond bag comta the per-bag fee. - it the average weight of the subteases exceeds 50 pounds, then the pansenger in charged the overage fee for aach bag. Thin applies to al1 baga, regardlasa of cabin. The overage fee in typica 11y y $0, but it may be ovexridden. F farite a function called calculate bag fee. calculate bag fee total weight of the bags, both integers. It nhould aliso have the following three keyword parameters, in this orders - cabin, with a default value of 'Main' 30 . - per bag fee, with a default value of 30. Fho function should return an integer representing the total Hag fee. fror example: \# calculate bag fee (2,105)140 \# calculate bag fee (2,105, cabin = First" )110 * calculate bag fee (2,95, per bag fee =50)z180 \# calculate bag_fee (2,105, overage_fee =80) f 220 * Add your code herel \#Below are some lines of code that will test your function. HYou can change the value of the variable(s) to test your Hfunction with different inputs. \#e your function works correctly, this will originally iripint: \# 140 * 110 * 100 220 print (calculate bag fee (2,105)) print (calculate bag_fee (2, 105, cabin m "First")) print (calculate bag_fee (2, 95, per bag fee = 50)). print (calculate bag_fee (2,105, overage fee =80)) Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored 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