Write a Python program to receive two numbers from the user, and print the results of...
Fantastic news! We've Found the answer you've been seeking!
Question:
![](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2023/09/64fad6fbedf2e_1694160635791.jpg)
![](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2023/09/64fad71a674bf_1694160666694.jpg)
Transcribed Image Text:
Write a Python program to receive two numbers from the user, and print the results of their multiplication. Two important issues: You must name your code file multiplier.py. • The input and output format of your programs must be identical to the examples provided in Table 1. Input Two numbers will be given to your program -as user input- in one line, separated from each other by a space. To take the user multiple inputs in one line use the following line of code: x, y input ().split() Input 11 3-1 80 -4-22 = Output You should simply print the result of multiplication in the output. Table 1: Samples of Provided Inputs and Expected Outputs Output -3 0 88 Task 4 ● ● ● Improve this program! The user should only be able to enter sensible numeric values for temperatures in Celsius (e.g., 4.7, -10, 143.5). Start by adding the following code to the top of your program. I'll go through it in more detail later in the course. Note: if copying from a PDF viewer, the indentation levels may not get copied correctly. If this happens, be sure to manually add the indentation levels (4 spaces per level). def isfloat(num): try: float(num) return True except ValueError: return False The above code will enable you to check if a given string is a float value, by writing, e.g., isfloat(celsius). Now, modify your code from Task 3, using the isfloat(...) function to make sure that the user has entered a value between, say, -200 and 200. If the value is valid, the program continues and converts the value to Fahrenheit as before. Otherwise, the program should tell the user that their value was invalid, and should prompt them for a new one. If you're doing this with an if-else block, it will only check once whether the value is valid. For bonus points, try to have the program repeat the check until the user enters a valid value. Hint: the best approach will include a while loop. See the below articles: W3Schools - Python While Loops Programiz – Python while Loop Write a Python program to receive two numbers from the user, and print the results of their multiplication. Two important issues: You must name your code file multiplier.py. • The input and output format of your programs must be identical to the examples provided in Table 1. Input Two numbers will be given to your program -as user input- in one line, separated from each other by a space. To take the user multiple inputs in one line use the following line of code: x, y input ().split() Input 11 3-1 80 -4-22 = Output You should simply print the result of multiplication in the output. Table 1: Samples of Provided Inputs and Expected Outputs Output -3 0 88 Task 4 ● ● ● Improve this program! The user should only be able to enter sensible numeric values for temperatures in Celsius (e.g., 4.7, -10, 143.5). Start by adding the following code to the top of your program. I'll go through it in more detail later in the course. Note: if copying from a PDF viewer, the indentation levels may not get copied correctly. If this happens, be sure to manually add the indentation levels (4 spaces per level). def isfloat(num): try: float(num) return True except ValueError: return False The above code will enable you to check if a given string is a float value, by writing, e.g., isfloat(celsius). Now, modify your code from Task 3, using the isfloat(...) function to make sure that the user has entered a value between, say, -200 and 200. If the value is valid, the program continues and converts the value to Fahrenheit as before. Otherwise, the program should tell the user that their value was invalid, and should prompt them for a new one. If you're doing this with an if-else block, it will only check once whether the value is valid. For bonus points, try to have the program repeat the check until the user enters a valid value. Hint: the best approach will include a while loop. See the below articles: W3Schools - Python While Loops Programiz – Python while Loop
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
-
On December 31, 2022, Akron, Incorporated, purchased 5 percent of Zip Company's common shares on the open market in exchange for $16,050. On December 31, 2023, Akron, Incorporated, acquires an...
-
2. A portfolio is composed of two stocks. The proportion of each stock, their expected values, and standard deviations are listed next. Stock 1 2 Proportion of portfolio 0.30 0.70 Mean 0.12 0.25...
-
7. Answer the questions below using the following information on stocks A, B, and C. A B C Expected Return 20% 21% 10% Standard Deviation 12% 10% 10% Beta 1.8 2.2 0.8 Assume the risk-free rate of...
-
1.think about the evolution of the food industry, What was it in the past, and what will it be in the future? How will the 4 p's of marketing evolve within the industry you selected? 2.What is one...
-
A firm faces the following average revenue (demand) curve: P 120 0.02Q where Q is weekly production and P is price, measured in cents per unit. The firms cost function is given by C 60Q 25,000....
-
Analyze a variable of your choice where you find the most appropriate measures of central tendency and variability.
-
11. Suppose there are 1-, 2-, and 3-year zero-coupon bonds, with prices given by P1, P2, and P3. The implied forward interest rate from year 1 to 2 is r0(1, 2) = P1/P2 1, and from year 2 to 3 is...
-
ALOHA Corp., started in January 2004, manufactures Hawaiian muumuus. At that time, the following material and labor standards were developed: Material .......3.0 yards at $4 per yard Labor...
-
Required information Exercise 12-12 Algo) Indirect Preparing statement of cash flows LO P2 P3, A1 The following formuborapies to the questions played below) The following financial statements and...
-
The following transactions of Jacks Auto Supply occurred in November (Balances as of November 1 are given for general ledger and accounts receivable ledger accounts: Danielson $1,100 Dr.; Wallace...
-
Starting with an energy balance on a disk volume element, derive the one-dimensional transient heat conduction equation for T(z, t) in a cylinder of diameter D with an insulated side surface for the...
-
Nequired information Exercise 5-17 (Static) Notes receivable-interest accrual and collection LO 5-6 (The following information applies to the questions displayed below) Agrico Incorporated accepted...
-
Case 14-3 Sarin Pharmaceuticals Ltd. Alan Mannik, director of procurement for the Sarin Phar- maceuticals Ltd. (Sarin) Animal Health Division plant in Vancouver, British Columbia, was planning for...
-
CL727 LEGAL ANALYSIS AND WRITING Module 11 Assignment: Brief Answer, Analysis, and Conclusion This assignment will be due in Module 11. Your assignment is to write the Brief Answer, Analysis, and...
-
Question 11 (0.5 points) l) Listen } As a drug manufacturer, you expect your latest wonder drug to lower cholesterol. It has been successful with a limited group of participants so far, so you have...
-
Redfern Audio produces audio equipment including headphones. At the Campus Facility, it produces two wireless models, Standard and Enhanced, which differ both in the materials and components used and...
-
F. If 23,000 units are produced, what are the total manufacturing overhead costs incurred? Total manufacturing overhead costs $ G. If 20,000 units are produced, what are the per unit manufacturing...
-
Why do bars offer free peanuts?
-
The following additional information is available for the Dr. Ivan and Irene Incisor family from Chapters 1-6. On December 12, Irene purchased the building where her store is located. She paid...
-
Clifford Johnson has a limited partnership investment and a rental condominium. Clifford actively manages the rental condominium. During 2012, his share of the loss from the limited partnership was...
-
Lisa Sizemore, a taxpayer in the 10-15 percent tax bracket, purchased stock as an investment on July 11, 2011. She sold the stock on July 9, 2012, 2 days before qualifying for the long-term holding...
-
CI9.3. Describe off-balance-sheet financing.
-
C19.1. Explain what a default premium is.
-
CJ9.2. Whatis the objective in reformulating financial statements for credit analysis? How does the reformulation for credit analysis differ from that for equity analysis?
![Mobile App Logo](https://dsd5zvtm8ll6.cloudfront.net/includes/images/mobile/finalLogo.png)
Study smarter with the SolutionInn App