python help please. will upvote!

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

python help please. will upvote!

Post by answerhappygod »

python help please. will upvote!
Python Help Please Will Upvote 1
Python Help Please Will Upvote 1 (536.64 KiB) Viewed 11 times
Python Help Please Will Upvote 2
Python Help Please Will Upvote 2 (494.69 KiB) Viewed 11 times
Python Help Please Will Upvote 3
Python Help Please Will Upvote 3 (474.36 KiB) Viewed 11 times
Python Help Please Will Upvote 4
Python Help Please Will Upvote 4 (377.85 KiB) Viewed 11 times
Functions In this assignment you're going to implement only functions. Be reminded that the generic structure of a function is the following: def function_name (arg1, arg2, etc.): #This line is the signature # commands go here # more commands # result = ... return result #This line returns the result of your computations The signature of each function is provided below, do not make any changes to them otherwise the tester will not work properly. Keep in mind that you must not write a main body for your program in this assignment. You should only implement these functions; it is the tester that will be calling and testing each one of them.
Dexter is working on a new experiment, but he knows that Dee Dee can go in and read his notes, so he has decided to substitute some letters with numbers so that Dee Dee won't be able to understand his notes so easily. Dexter is using these tables to change the letters: Letters 0 I E 0 i Z e a Examples: Number 0 1 2 3 Letters S G S60 T B P Р t b Parameters: text (string) Return value: The new text (string) change_text("Hello World") change_text("Python rocks!") Number 5 6 def change_text (text): Description: Given a text, return the new text with the letters replaced by numbers taking into account the replacement tables described above. 7 8 9 个个个 'H3110 World' '9y7h0n rock5!! 0123 4567 change_text("My function works") → 'My func710n work5'
Mee Mee and Lee Lee have come to visit Dee Dee and she remembers that there are cookies, muffins and sweets, so she takes three plates and puts the same amount of each dessert on each plate and what is left on a table. In case there is not enough of any dessert (<3), Dee Dee puts that dessert on the table and nothing on each plate. def dessert_distribution (qty_c, qty_m, qty_s): Description: Given the quantity of cookies (qty_c), muffins (qty_m) and sweets (qty_s), return how they would be distributed on each plate and on the table. Parameters: quantity of cookies (qty_c), muffins (qty_m) and sweets (qty_s). Each integer. HOT Assume qty_c, qty_m, qty_s are >=1 and <=7 Return value: How the desserts would be distributed on each plate and on the table (string). Use a tab to separate each distribution. If a dessert is not placed on a plate or on the table, do not print any character for it. Examples: dessert_distribution (2,4,7) → dessert_distribution (3,6,3) → dessert_distribution (1,2,1)→ 3
Mandak has heard about Dexter's new experiment and decides to buy what he needs to try to finish it first. On a list, he writes down (in order of priority) the items he must buy. He wants to know how many items can purchase with the cash he currently has. def how many_items (items, cash): Description: Given a list of items and cash, return how many items can be purchase. Parameters: items (list of strings), cash (float). Assume The length of the list is >=1 and <=10 An item can be more than once in the list. Return value: how many items can be purchase (int), based on the items list and these prices: Item batteries hammer screwdriver box nails screws steel cable spray paint Examples: Price 6.99 29.98 5.97 1.19 0.59 8.99 4.49 BATTERY AN 3 how many items (["hammer", "screws", "box nails"], 33.57) → how_many_items (["batteries", "screws"],5) how_many_items (["screws","screws", "screws"],1.76) 302
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply