First, PrimeFinder should ask how many numbers the user has decided to pass to PrimeFinder using...
Fantastic news! We've Found the answer you've been seeking!
Question:
![](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2023/09/64f81091d32c9_1693978769711.jpg)
Transcribed Image Text:
First, PrimeFinder should ask how many numbers the user has decided to pass to PrimeFinder using the message 'How many numbers do you want to check? '. Let's call the provided number by user n. For n times PrimeFinder should print 'Enter a positive integer: ' and take a positive integer from the user. For each prime number, PrimeFinder prints out 'X is a prime number.' where X is the number provided by the user in that round. For each nonprime number PrimeFinder does not print out a message. PrimeFinder assumes that its users are smart enough not to enter a float number. If the user inserts a negative number PrimeFinder should ignore it and inform the user by the message 'PrimeFinder ignores negative numbers!'. For instance, if n=2 the user-provided sequence of numbers can be 3, 5 or 2, -4, -7, 5. In other words, PrimeFinder will continue working until it gets exactly positive integers. Finally, PrimeFinder prints out the total count of prime numbers received from the user, Y, in the following format: 'Total prime numbers: Y'. Figure 3 shows a sample output of PrimeFinder. You must name your code file q3.py and upload it to the HW1Q3: PrimeFinder section on Gradescope. How many numbers do you want to check? 3 Enter a positive integer: 4 Enter a positive integer: 1-2 PrimeFinder ignores negative numbers! Enter a positive integer: 2 2 is a prime number. Enter a positive integer: 47 47 is a prime number. Total prime numbers: 2 First, PrimeFinder should ask how many numbers the user has decided to pass to PrimeFinder using the message 'How many numbers do you want to check? '. Let's call the provided number by user n. For n times PrimeFinder should print 'Enter a positive integer: ' and take a positive integer from the user. For each prime number, PrimeFinder prints out 'X is a prime number.' where X is the number provided by the user in that round. For each nonprime number PrimeFinder does not print out a message. PrimeFinder assumes that its users are smart enough not to enter a float number. If the user inserts a negative number PrimeFinder should ignore it and inform the user by the message 'PrimeFinder ignores negative numbers!'. For instance, if n=2 the user-provided sequence of numbers can be 3, 5 or 2, -4, -7, 5. In other words, PrimeFinder will continue working until it gets exactly positive integers. Finally, PrimeFinder prints out the total count of prime numbers received from the user, Y, in the following format: 'Total prime numbers: Y'. Figure 3 shows a sample output of PrimeFinder. You must name your code file q3.py and upload it to the HW1Q3: PrimeFinder section on Gradescope. How many numbers do you want to check? 3 Enter a positive integer: 4 Enter a positive integer: 1-2 PrimeFinder ignores negative numbers! Enter a positive integer: 2 2 is a prime number. Enter a positive integer: 47 47 is a prime number. Total prime numbers: 2
Expert Answer:
Related Book For
Introduction to Management Science A Modeling and Cases Studies Approach with Spreadsheets
ISBN: 978-0078024061
5th edition
Authors: Frederick S. Hillier, Mark S. Hillier
Posted Date:
Students also viewed these programming questions
-
To meet the rising demand for its finished products, Xenon Inc., is automating its manufacturing process. However, most of Xenon's employees prefer the previous process and are finding it difficult...
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
The Crazy Eddie fraud may appear smaller and gentler than the massive billion-dollar frauds exposed in recent times, such as Bernie Madoffs Ponzi scheme, frauds in the subprime mortgage market, the...
-
South Sea Baubles has the following (incomplete) balance sheet and income statement. a. What is shareholders' equity in 2013 and 2014? b. What is net working capital in 2013 and 2014? c. What are...
-
Treetops Hammocks produces lightweight nylon hammocks designed for campers, scouts, and hikers. The hammocks come in two styles: double and single. The double hammocks sell for $225 each. They incur...
-
What is meant when it is said that an exception is thrown?
-
Explain what share buybacks involve and discuss the main issues that they raise.
-
On September 3, 2011, the Robers Company exchanged equipment with Phifer Corporation. The facts of the exchange are as follows: To equalize the exchange, Phifer paid Robers $5,000 in cash. Required:...
-
In the workflow for the material cost (shown), some steps are replaced with numbers. Match each number with its corresponding step (with correct explanation) to complete the workflow
-
In 2007, Slater & Gordon (S&G) became the worlds first law firm listed on a stock exchange. S&G is headquartered in Melbourne, where William Slater and Hugh Gordon founded it in 1935. Progressively,...
-
A $35 million par value bond was sold at 101.The premium is transferred to the debt service fund.Create the journal entries for both funds.
-
Suppose that your credit card activity for December looked like this: Date Activity December 5 $384 purchase December 11 $347 purchase December 16 $174 purchase December 21 $480 purchase December 25...
-
A research group surveyed 300 students. The students were asked how often they go to the movies and whether they prefer comedies or dramas. Their responses are summarized in the following table....
-
C. Prove the following (you can use any formal induction/other theoretical method, "A" means power here): i. ii. iii. What is the time complexity recurrence relation for Fibonacci numbers? Explain it...
-
You and your partner run a small business together, with separate work roles. You are responsible for the business budget and have researched an improved budget process which you felt needs to be...
-
The actual selling expenses incurred in March 2022 by Carla Vista Company are as follows: Variable Expenses Fixed Expenses Sales commissions Advertising $14,576 Sales salaries $34,700 12.174...
-
The following list of balances as at 30 September 20X9 has been extracted from the books of Brick and Stone, trading partnership, sharing the balance of profits and losses in the proportions 3:2...
-
On 1 July 2021, Croydon Ltd leased ten excavators for five years from Machines4U Ltd. The excavators are expected to have an economic life of 6 years, after which time they will have an expected...
-
Reconsider the Wyndor Glass Co. case study introduced in Section 2.1. Suppose that Bill Tasto (Wyndor's vice president for manufacturing) now has found a way to provide a little additional production...
-
You are given the following decision tree, with the probabilities at event nodes shown in parentheses and with the payoffs at terminal points shown on the right. Analyze this decision tree to obtain...
-
Read the referenced article that fully describes the management science study summarized in the application vignette presented in Section 10.3. Briefly describe how forecasting was applied in this...
-
EXCEL CASE The City of Loveland previously adopted GASB Statement 34. Now city officials are attempting to determine reported values for major infrastructure assets that it had obtained prior to the...
-
COMMUNICATION CASE 1 Read the following articles and any other papers that are available on setting governmental accounting standards: 25 Years of State and Local Governmental Financial ReportingAn...
-
ANALYSIS CASE 2 Go to Web site www.portlandonline.com/omf/index.cfm?c=43896 and find the 2006 comprehensive annual financial report for the City of Portland, Oregon. One of the most important changes...
![Mobile App Logo](https://dsd5zvtm8ll6.cloudfront.net/includes/images/mobile/finalLogo.png)
Study smarter with the SolutionInn App