First, PrimeFinder should ask how many numbers the user has decided to pass to PrimeFinder using...
Fantastic news! We've located the answer you've been seeking!
Question:
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 userprovided 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: 12 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: 9780078024061
5th edition
Authors: Frederick S. Hillier, Mark S. Hillier
Posted Date:
Students also viewed these programming questions

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 billiondollar frauds exposed in recent times, such as Bernie Madoffs Ponzi scheme, frauds in the subprime mortgage market, the...

The FBI Standard Survey of Crimes shows that for about 80% of all property crimes (burglary, larceny, car theft, etc.), the criminals are never found and the case is never solved (Source: True Odds,...

As part of their training, NASA astronauts are placed in large rotating machines to see how well their bodies can withstand various g forces. (One g equals the gravitational force of gravity at the...

Benzene, C 6 H 6 , and toluene, C 6 H 5 CH 3 , form an ideal solution. The vapor pressure of benzene is 94.6 Torr and that of toluene is 29.1 Torr at 25C. What is the vapor pressure of each component...

It is necessary to transfer 2048 words from a hard drive to a section of memory starting from address 4096. The transfer is by means of DMA, as shown in Figure 1120. Figure 1120 (a) Give the...

As part of your systems analysis project to update the automated accounting functions for Xanadu Corporation, a maker of digital cameras, you will interview Leo Blum, the chief accountant. Write four...

The pollution of the River Wye in Herefordshire has been widely attributed to discharges from chicken farms in a neighbouring county. Use economic theories to describe what measures governments can...

Write a paper about knowledge management strategy formulation this project provides an opportunity for you to identify opportunities for knowledge management at a realworld business and to suggest...

Show that the Bcklund transformations: Py  Vy = VZelotu)/2 connect to partial differential equation y = Ojand Liouville's equation yy = e Also use the solution of b = 0 in the Bcklund...

Find the inverse of each matrix in Problems 6168, if it exists. 1 4 44 2 3 204 0 04

Find the inverse of each matrix in Problems 6168, if it exists. 4 4 5 22 20 0 5

What is the impact of ORDBMSs on normalization?

Discuss the following collection types: set, multiset, list, and array. Illustrate with examples.

Problems 3148 refer to the following matrices: Perform the indicated operations, if possible. A = C = 2 0 1 4 2 1 3 4 2 0 2 1 5 3 3 B = D= 3 30 25 0  2

Question 1 When a Total Station is setup in the Circle Left position, the Horizontal readings will increase when the instrument is turned clockwise. True False

(a) With not more than 300 words, examine why Malaysia missed its 2020 targets to divert 40% of waste from landfills and increase recycling rates to 22%. (10 marks) b) Why arent Malaysian recycling?...

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...

Consider the threefactor stochastic volatility model [see (7.3.17)], by assuming constant market prices of risk r , r and v , show that the bond price function B(t, T) satisfies the partial...

Suppose L i (t)satisfies the LLM model as in Problem 8.30. Here, we would like to find the stochastic differential equation of L i (t) under the spot LIBOR measure QM whose numeraire is the discrete...

Let the exchange rate process X(t), T maturity domestic and foreign bond processes B d (t, T ) and B f (t, T ) be the same as those defined in Problem 8.9. Find the timet value of the LIBOR spread...
Question Categories