Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

IN PHYTHON Deliverable You are required to complete Question 17 and 18 of Chapter 5 programming exercises. 17. Prime Numbers A prime number is a

IN PHYTHON

Deliverable

You are required to complete Question 17 and 18 of Chapter 5 programming exercises.

17. Prime Numbers

A prime number is a number that is only evenly divisible by itself and 1. For example, the number 5 is prime because it can only be evenly divided by 1 and 5. The number 6, however, is not prime because it can be divided evenly by 1, 2, 3, and 6. Write a Boolean function named is_prime which takes an integer as an argument and returns true if the argument is a prime number, or false otherwise. Use the function in a program that prompts the user to enter a number then displays a message indicating whether the number is prime. Tip: Recall that the % operator divides one number by another and returns the remainder of the division. In an expression such as num1 % num2, the % operator will return 0 if num1 is evenly divisible by num2.

18. Prime Number List

This exercise assumes that you have already written the is_prime function in Programming Exercise 17. Write another program that displays all of the prime numbers from 1 to 100. The program should have a loop that calls the is_prime function.

To prepare for this Assignment:

Review Chapters 1-6 of the textbook (Starting out with Python by Tony Gaddis)

Use the development environment set up during this week's discussion.

Use any text editor of your choice to create your code.

Zip up all code/project folder in a Folder named "CS202-Mod1-Your Name

Write and document with a screenshot of each step of the exercise in a Word document.

Submit the zip folder and the Word document.

Use the rubric below to estimate your grade on the Assignment.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Microsoft Office 365 For Beginners 2022 8 In 1

Authors: James Holler

1st Edition

B0B2WRC1RX, 979-8833565759

More Books

Students also viewed these Databases questions

Question

1. Why do people tell lies on their CVs?

Answered: 1 week ago

Question

2. What is the difference between an embellishment and a lie?

Answered: 1 week ago