Answered step by step
Verified Expert Solution
Question
1 Approved Answer
The following snippets of code are fully functional snippets. They can be placed in a python source file (a file ending in .py) and then
The following snippets of code are fully functional snippets. They can be placed in a python source file (a file ending in .py) and then executed. First predict what you think the output will be. Then paste the code into a python file, try it, and record the actual result. \begin{tabular}{|l|l} Output 4 & def coins (total, denomination) : num = int(total / denomination) return total - (num * denomination) \\ print (num, " , end="") if denomination ==0.25: print ("quarters") elif denomination ==0.10: print ("dimes") \\ \hline \end{tabular} \begin{tabular}{|l|l} & elif denomination ==0.05: \\ print("nickels") \\ else: \\ print("pennies") \end{tabular} Write code snippets to do the following. You should write these in a Python editor and test them out as you go. When they work (or even if they don't), copy and paste your final code snippet here. \begin{tabular}{l} print("How tall is your vehicle?") \\ feet = int(input("feet > ")) \\ inches = int(input("inches > ")) \\ if fits_under_bridge(feet, inches): \\ print("Wheew, you'll make it.") \\ else: \\ print("Better turn around. Your vehicle is too tall.") \\ \hline \end{tabular} Answer the following questions then submit the assignment. The code is referring to the above "Predicting the result (functions that return) document. 1. In Code 2 , why can we put the function call inside the print function? 2. In Code 4, the program is suppose to convert a money amount into the number of quarters, dimes, nickels, and pennies. Does it work? For example: $16.65 has 66 quarters, 1 dime, 1 nickel, and 0 pennies. If it doesn't work can you explain what the problem is. 3. Complete the function for Code 6 and post the code here
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