21. What is a output of the following Python program if input is 4? (2 points)...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
21. What is a output of the following Python program if input is 4? (2 points) num= int(input("Enter a number: ")) factorial = 1 if num < 0: print("Sorry, factorial does not exist for negative numbers") elif num 0: print("The factorial of 0 is 1") else: for i in range(1,num + 1): factorial factorial*i print("The factorial of",num,"is",factorial) ANSWER: 21. What is a output of the following Python program if input is 4? (2 points) num= int(input("Enter a number: ")) factorial = 1 if num < 0: print("Sorry, factorial does not exist for negative numbers") elif num 0: print("The factorial of 0 is 1") else: for i in range(1,num + 1): factorial factorial*i print("The factorial of",num,"is",factorial) ANSWER:
Expert Answer:
Answer rating: 100% (QA)
The provided image shows a Python program that calculates the factorial of a given number Based on t... View the full 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
-
Stephanie and Cody Riley of Newport Rhode Island desire an annual retirement income of 40000 They expect to live for 30 years past retirement Assuming that the couple could earn a 3 percent aftertax...
-
(a) Answer each of the following: (i) Briefly explain the meaning of the term 'couple'. (ii) (2 marks) The caster unit is subjected to the pair of 400 N forces shown in Fig. 1(a). Calculate the...
-
What are the challenges and opportunities associated with the development of biopharmaceuticals, including monoclonal antibodies, therapeutic proteins, and gene therapies, for clinical use ?
-
Draw a simple undirected graph G that has 12 vertices, 18 edges, and 3 connected components.
-
Stratford Corporation is a diversified company whose products are marketed both domestically and internationally. Its major product lines are pharmaceutical products, sports equipment, and household...
-
Use a numerical integration routine to evaluate each definite integral in Problem (to three decimal places). 2.5 In x .2 0.5
-
To calculate the expected frequencies, we must know the row totals, the column totals, and the ________________ total. In Exercises 35, fill in each blank with the appropriate word or phrase.
-
High-low, regression Pat Flip is the new manager of the materials storeroom for Serth manufacturing. Pat has been asked to estimate future monthly purchase costs for part #4599, used in two of Serths...
-
7. Jake Bradford is the owner of Jake's Judo Competitive Club. Sales in the business are done on a cash basis. Goods and services are purchased by the business on credit. These are Jake's accounts: 3...
-
The TARDIS Corporation produces and sells a single product--Sonic Screwdrivers. TARDIS has the capacity to produce 100,000 Sonic Screwdrivers each year. If TARDIS produces at capacity, the per unit...
-
In this problem you have to construct a random variables (i.e., their distributions) so that their mgf satisfies certain properties. (a) Describe a random variable X such that gx (r) is not finite...
-
A hollow cylindrical steel shaft is 1.5 m long and has inner and outer diameters respectively equal to 40 and 60 mm. a) What is the largest torque that can be applied to the shaft if the shearing...
-
Companies are moving away from traditional marketing approaches (eg. TV, radio, print ads) and are now spending more on digital marketing (social media, blogging, email marketing, push notifications)...
-
What would be the equilibrium price and equilibrium number of services in this market? What is the efficient number of services, and what is the price at which the efficient number of services could...
-
Given the fixed beam shown in the figure below (Fig Q10) solve the following problem. Using three (3) elements of equal length calculate the displacement w, given the following parameters. 1. The...
-
1. Explain how silence can be used effectively in counselling. 2. Building Self-Awareness: Cultural Iceberg Activity Steps for Activity: 1) Find PDF of Iceberg Activity in Week 4 Folder 2) Consider...
-
119. Which of the following is/are true statements : 1: Under NIS - 1st dose of Pentavalent vaccine can be given till (Max limit: 2 year 2: Onset of dessiminated BCG infection after BCG is seen...
-
Consider the combustion of methanol below. If 64 grams of methanol reacts with 160 grams of oxygen, what is the CHANGE in volume at STP. 2CH3OH(g) + 3O2(g) 2CO2(g) + 4H2O(1) The volume decreases by...
-
During 2012, Palo Fiero purchases the following property for use in his manufacturing business: Palo uses the accelerated depreciation method under MACRS, if available, and does not make the election...
-
Your supervisor has asked you to research the following situation concerning Owen and Lisa Cordoncillo. Owen and Lisa are brother and sister. In May 2012, Owen and Lisa exchange business pickup...
-
Harold Conners (Social Security number 785-23-9873) lives at 13234 DeMilo Drive, Houston, TX 77052, and is self-employed for 2012. He estimates his required annual estimated tax payment for 2012 to...
-
Based on Equation 5.46, what value of \(\beta\) would result in the annual minimum value of the incidence angle \(i\) ? Note that this tilt angle would result in maximum collection of beam radiation...
-
Equation 5.53 is based on an early solar constant value of \(1394 \mathrm{~W} / \mathrm{m}^{2}\). Derive a modified form of Equation 5.53 based on the presently accepted value for the solar constant...
-
(a) Design a PI controller for Problem 8.6-4(b). (b) Design a PD controller for Problem 8.6-4(c). (c) Use the results of parts (a) and (b) to repeat Problem 8.6-4(d). Problem 8.6-4(b) (c) (d) (b)...
Study smarter with the SolutionInn App