Prime Number In a well-commented Python program hmwk2Q3.py, extend the solution provided in Question 2 to determine if the integer N is a prime number. Include a screen capture Hmwk2Q3.jpg for the test case below. Is The Integer Prime ? Enter an integer: 7919 7919 is Prime Hmwk2Q3.jpg

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
Prime Number
In a well-commented Python program hmwk2Q3.py, extend the solution provided in Question 2 to determine if the
integer N is a prime number. Include a screen capture Hmwk2Q3.jpg for the test case below.
Is The Integer Prime ?
Enter an integer: 7919
7919 is Prime
Hmwk2Q3.jpg
Transcribed Image Text:Prime Number In a well-commented Python program hmwk2Q3.py, extend the solution provided in Question 2 to determine if the integer N is a prime number. Include a screen capture Hmwk2Q3.jpg for the test case below. Is The Integer Prime ? Enter an integer: 7919 7919 is Prime Hmwk2Q3.jpg
Expert Solution
Explanation

1) Below is python program to determine if the integer N is prime number.

  • It display the message to user for prime checking(Is the Integer Prime ?)
  • It ask user to enter an integer using input function, convert it to integer and assign it to num variable
  • Check if number is prime or not
  • If number greater than 1 can be prime
    • Iterate from 2 to num / 2 using for loop
      • If num is divisible by any number between 2 and n / 2, it is not prime
        • display number is not prime
      • else, display number is prime
  • for num value 1 display it is not prime number

2) Save program in hmwk2Q3.py file and run

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY