Answered step by step
Verified Expert Solution
Question
1 Approved Answer
co n e w content8453069/View 1.) Write a function called print word that has two parameters. The first is an integer (assume it will always
co n e w content8453069/View 1.) Write a function called print word that has two parameters. The first is an integer (assume it will always be non negative). The second is a string. Print the string on the given number of lines, each time preceded by a line number and an arrow. See the examples below for the format of the output (i.e. If you call your function with the same arguments as in the examples your output should look like the output in the examples). The code executed is in blue, the output produced is in green): print_word (3, banana 1 --> banana 2 --> banana 3 --> banana print word (4, 'mississippi 1 --> mississippi 2 --> mississippi 3 --> mississippi 4 --> Mississippi (submit via D2L Assignments) Please read the instructions below carefully and follow them closely. All problems (and parts of problems) are required except as noted in the instructions below. Important: your filenames must be identical to the filenames given below. For any functions you are asked to write the function signature (header) must be exactly as described in the instructions. That is, you must use the exact function names given in the instructions, you must have the parameters the instructions ask for, and the parameters must be in the order the instructions give. Also important; make sure you always save a backup of your work somewhere safe (such as UA Box or Google Drive) "le/content/818319/viewcontent/8453069/View 2.) Write a function called bacteria that will print out the number of bacteria in a Petri dish as time goes by. The function has two parameters. The first is an integer giving the number of minutes it takes for a bacterium to split into two new bacteria. The second is an integer giving the number of bacterial generations to include in the output. Assume you always begin with a single bacterium in the dish and every bacterium always splits into exactly two bacteria at the end of each time period. Here are some examples of calling the function with different arguments. (The code executed is in blue, the output produced is in green): bacteria (10, 5) after 10 minutes: 2 bacteria after 20 minutes: 4 bacteria after 30 minutes : 8 bacteria after 40 minutes: 16 bacteria after 50 minutes: 32 bacteria bacteria (21, 3) after 21 minutes: after 42 minutes: after 63 minutes : 2 bacteria 4 bacteria 8 bacteria 3.) Write a function called convert to copper that has three integer parameters. The first represents a number of gold coins. The second represents a number of silver coins. The third represents a number of copper coins. The function will print the numbers of each type of coin followed by the total value of all of the coins when converted to copper. The exchange rate for coins is: 5 copper pieces (cp) = 1 silver piece (sp) 10 silver pieces - 1 gold piece (gp)
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