Coding Questions: 1. Write a function, mult that multiplies two numbers, and returns the product. Choose...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Coding Questions: 1. Write a function, mult that multiplies two numbers, and returns the product. Choose how many parameters you need, and what names to use. 2. A) Write a function, add that adds two numbers, and returns the sum. Choose how many parameters you need, and what names to use. B) Write a function, add_sqrt that accepts two arguments: num_1, num_2. In the function, call your function add with arguments num_1, num_2. Then save the return valu of add a variable called sum. Next, call the math.sqrt function from the math library with the argument sum. Then save the return value of math.sqrt in a variable called root. Next, call the built-in function print with the parameter root 3. Write a program that finds the surface_area of a cube given the edge as an argument. The function should print the surface area and return it. 4. Write a program that calculates the tax using a function with two parameters: the wage and tax rate. The function should return the tax. Call this function in different ways. 5. Write two functions: an average function that finds and returns the average of some values given as arguments. Use the output of the average function as the argument of the grade function which outputs the letter grade, given the average grade. You can decide on the grade boundaries yourself. 6. Modify the temperature problem from Lab 6 so it uses functions. 1) Create a list with temperature values entered as input by the user. The program should allow the user to enter as many temperatures as they like, and only stop when the user enters "-1". From the list find the total temperature. Discard the temperature if it is not within the [0, 100] range and print a message if out of range. Calculate the total, the average temperature, the minimum, maximum and the median. 2) Use a for loop to print numbers from 1 - 10 3) Use a for loop to print multiples of 4 smaller than 21 4) Create a dictionary that maps hexadecimal numbers to their binary values with 16 entries. The program should output the binary value of the hexadecimal number. First you need to make sure that the key exists; if it doesn't the program should output a message and ask the user to try again. Coding Questions: 1. Write a function, mult that multiplies two numbers, and returns the product. Choose how many parameters you need, and what names to use. 2. A) Write a function, add that adds two numbers, and returns the sum. Choose how many parameters you need, and what names to use. B) Write a function, add_sqrt that accepts two arguments: num_1, num_2. In the function, call your function add with arguments num_1, num_2. Then save the return valu of add a variable called sum. Next, call the math.sqrt function from the math library with the argument sum. Then save the return value of math.sqrt in a variable called root. Next, call the built-in function print with the parameter root 3. Write a program that finds the surface_area of a cube given the edge as an argument. The function should print the surface area and return it. 4. Write a program that calculates the tax using a function with two parameters: the wage and tax rate. The function should return the tax. Call this function in different ways. 5. Write two functions: an average function that finds and returns the average of some values given as arguments. Use the output of the average function as the argument of the grade function which outputs the letter grade, given the average grade. You can decide on the grade boundaries yourself. 6. Modify the temperature problem from Lab 6 so it uses functions. 1) Create a list with temperature values entered as input by the user. The program should allow the user to enter as many temperatures as they like, and only stop when the user enters "-1". From the list find the total temperature. Discard the temperature if it is not within the [0, 100] range and print a message if out of range. Calculate the total, the average temperature, the minimum, maximum and the median. 2) Use a for loop to print numbers from 1 - 10 3) Use a for loop to print multiples of 4 smaller than 21 4) Create a dictionary that maps hexadecimal numbers to their binary values with 16 entries. The program should output the binary value of the hexadecimal number. First you need to make sure that the key exists; if it doesn't the program should output a message and ask the user to try again.
Expert Answer:
Related Book For
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill
Posted Date:
Students also viewed these programming questions
-
Design a Java class that represents a cache with a fixed size. It should support operations like add, retrieve, and remove, and it should evict the least recently used item when it reaches capacity.
-
Let A, B be sets. Define: (a) the Cartesian product (A B) (b) the set of relations R between A and B (c) the identity relation A on the set A [3 marks] Suppose S, T are relations between A and B, and...
-
Compare to traditional organizational development approaches. To get back on track and find a way to function more smoothly, should this taskforce use an Appreciative Inquiry approach or a more...
-
By how much does the whale's speeds change (in knots) as a result of this collision? A. 0.95 B. 1.1 C. 2.5 D. 4.1
-
Refer to Data Set 3 ?Body Temperature? in Appendix B and use the body temperatures for 12:00 AM on day 2. Refer to the indicated data set in Appendix B. Use software or a calculator to find the...
-
A 22 in. by 34 in. speed limit sign is supported on a 3 -in.-wide, 5 -ft-long pole. Estimate the bending moment in the pole at ground level when a 30 -mph wind blows against the sign. List any...
-
1. For each of the accounting issues discussed in the body of the case and in Exhibit 2: a. Discuss whether the accounting rule seems reasonable. b. Discuss whether it seems likely that Dell recorded...
-
You are the assistant manager of a small community clinic. It's a busy Monday morning, two of your staff called in sick: the clinic manager and a clerk. A Centers for Medicare and Medicaid Services...
-
1. Create and upload a histogram of the salary data for the city of Bell, where each bar width is about 50,000 US dollars. (Data for the histogram is at the bottom). a.) Is the distribution of the...
-
1) Decompose Teslas ROE for the annual periods 2012-2014. Note any trends you observe. 2) Tesla notes that Q1 automotive revenue includes $51 million from the sale of ZEV credits.*Assuming that...
-
According to the balanced chemical equation below, how many grams of H 2 O would be producedif 18.08 grams of O 2 reacted with excessC 8 H 18 ? 2 C 8 H 18 + 25 O 2 --> 16 CO 2 + 18 H 2 O
-
HAWK Inc. who is a publicly traded company is considering acquiring EAGLE Inc. which is a private company. Please use the information and methods taught to you in class and construct an NPV analysis....
-
What are the pros and cons of a participative leader. Explain.
-
Provide, STR report and report analysis for Marriott Hotels.(With references)
-
complete these python: json_data={"column...
-
1. By respecting the human rights of the population, can a higher level of human development be achieved? explain why
-
Cornell and Roberts are partners who agree to admit Stanley to their partnership. Cornell has a capital balance of $80,000 and Roberts has a capital balance of $120,000. Cornell and Roberts share net...
-
Deborah purchases a new $30,000 car in 2012 to use exclusively in her business. If Deborah does not elect to expense or take bonus depreciation in 2012 and holds the car until it is fully...
-
Charlie's Green Lawn Care is a cash basis taxpayer. Charlie Adame, the sole proprietor, is considering delaying some of his December 2012 customer billings for lawn care into the next year. In...
-
Robert Ramos (age 36) is a single taxpayer, living at 8765 Bay Dr., Monterey, CA 93940. His Social Security number is 976-23-5132. Robert's earnings and income tax withholding as the manager of a...
-
On 1 January 2023, Blue Jay Ltd revalued land from \(\$ 300000\) to \(\$ 500000\). On 1 January 2024, the company subsequently revalued the land to \(\$ 420000\). And on 1 January 2025 , the company...
-
The following data from Lyre Ltd's accounts relates to two assets at 30 June 2023. At 30 June 2023 Lyre Ltd decides to adopt the revaluation model for both these assets. On this date land has a fair...
-
Crane Ltd has proposed that the company adopt the revaluation model for fixed assets. Some of these assets are hard to obtain and certain items have increased in value in the current period, however...
Study smarter with the SolutionInn App