A positive integer greater than one is considered prime if it has no divisors other than...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
A positive integer greater than one is considered prime if it has no divisors other than one and itself. A positive integer greater than 1 is a composite if it is not prime. Write a program that asks the user to enter an integer greater than 1, then displays all of the prime numbers that are less than or equal to the number entered (15 points). The program should work as follows: Once the user has entered a number, the program should populate a list with all the integers from 2 up to the value entered. The program should then use a loop to step through the list. The loop should pass each element to a function that displays the element, whether it is a prime number. 2: Write a Python program to get a shop's top three items' prices. (15 points) Sample data: {'Apple': 0.50, 'Banana': 0.20, 'Mango': 0.99, 'Coconut': 2.99, 'Pineapple': 3.99} Expected Output: Pineapple 3.99 Coconut 2.99 Mango 0.99 A positive integer greater than one is considered prime if it has no divisors other than one and itself. A positive integer greater than 1 is a composite if it is not prime. Write a program that asks the user to enter an integer greater than 1, then displays all of the prime numbers that are less than or equal to the number entered (15 points). The program should work as follows: Once the user has entered a number, the program should populate a list with all the integers from 2 up to the value entered. The program should then use a loop to step through the list. The loop should pass each element to a function that displays the element, whether it is a prime number. 2: Write a Python program to get a shop's top three items' prices. (15 points) Sample data: {'Apple': 0.50, 'Banana': 0.20, 'Mango': 0.99, 'Coconut': 2.99, 'Pineapple': 3.99} Expected Output: Pineapple 3.99 Coconut 2.99 Mango 0.99
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
-
Stahelin Valves produces a single component, a valve. The valve sells for $43 per unit. Fixed costs are $1,605,000 annually. Production and sales of 407,000 units annually results in profit before...
-
You are required to write a Python program that will manage character (heroes and villain) information. Character (hero and villain) information will be stored in a text file that will be read in...
-
The following are trial balance of Clarissa Amanda Sdn. Bhd. as at 31st December 2021. Debit RM Credit RM Opening stock, 1 Jan 2021 16,000 Purchases 75,000 Sales return 5,000 Carriage inwards 1,500...
-
Trang had a rental home that received a notice of noncompliance because of her failure to maintain repairs. She received the notice on September 1, 2022 and did not complete any of the repairs until...
-
Use the function described in Example 4.3, xn+1 = axan (1 xn2) where a = 2.5. Consider two starting values of x1 that are similar, 0.900 000 0 and 0.900 000. Make a plot of xn versus n for the two...
-
On February 11th, 2024, in Super Bowl LVIII, the place-kicker will be kicking a football from a point 51.2 m from the field goal crossbar. The crossbar is 3.05 m high. When kicked, the ball leaves...
-
Consider the regression models described in Example 8.4. Example 8.4 a. Graph the response function associated with Eq. (8.10). Equation (8.10) b. Graph the response function associated with Eq....
-
Harrelson Inc. currently has $750,000 in accounts receivable, and its days sales outstanding (DSO) is 55 days. It wants to reduce its DSO to 35 days by pressuring more of its customers to pay their...
-
Warm Hands, a small company based in Prince Edward Island, manufactures and sells two types of lightweight gloves for runners- Warm and Cozy. Current revenue, cost, and unit sales data for the two...
-
Furniture Land Inc. is a producer and retailer of high-end custom-designed furniture and uses the contract-based approach to revenue recognition. The company produces only to special order and...
-
#12 BC Industries is considering the possibility of a new warehouse. The cost of this asset is assumed to be $260,000 and the company expects to generate cash flows of $70,000 per year for the next 5...
-
Brembo, an Italian automotive braking-systems supplier, has three alternative carbon ceramic suppliers, all of which offer different terms. Except for the different credit terms, their products are...
-
Alessandro is a successful soccer player. He is considering buying a new Porsche. There are two options available: the new Porsche Panamera and the Porsche Boxter. Whichever model he chooses he plans...
-
Heidelberg Cement, one of the worlds largest building materials companies is concerned about preserving the wealth of its stockholders during a cyclical downturn in the building and construction...
-
A college professor taught an interdisciplinary course in the last 3 years to students of different majors. He believes that the students majors do not have any impact on their performance in the...
-
The following data are available on Volkswagen AG as of December 22, 2017: The firms board is currently considering whether it should use 295,000,000 of its earnings to pay cash dividends of 1 per...
-
Determine the following integrals 41 42 43 44 45 46 COS X 2-3x dx e dx *+sec x e' + tan x - dx e cosec i dx (2) (2) (2) (3) Determine the area which lies below the x-axis enclosed between the curve...
-
When an electric field is applied to a shallow bath of vegetable oil, why do tiny bits of thread floating in the oil align with the field like compasses in a magnetic field?
-
Teresa is a civil engineer who uses her automobile for business. Teresa drove her automobile a total of 21,732 miles during 2012, of which 95 percent was business mileage. The actual cost of...
-
Rebecca and Walter Bunge have been married for 5 years. They live at 883 Scrub Brush Street, Apt. 52B, Las Vegas, NV 89125. Rebecca is a homemaker and Walt is a high school teacher. Rebecca's Social...
-
Cypress Corporation has regular taxable income of $170,000 (assume annual gross receipts are greater than $5 million) and regular tax liability of $49,550 for 2012. The corporation also has tax...
-
Midwest Energy Group has issued preferred stocks ($10 par value) that pay 8 percent dividend annually. If the required rate of return is 15 percent, what is the value of the stock?
-
You are considering an investment in one of the preferred stocks of either Longines Watch Company or Titoni Watch Company. Longiness preferred stock pays an annual dividend of \($2.73,\) while that...
-
Calculate the value of Swatchs preferred stock that pays a dividend of $8 per share if your required rate of return is 14 percent.
Study smarter with the SolutionInn App