Question: Question 5 Simple Programming Problems using Python Note: maximum award of 10 marks. A positive whole number n > 2 is prime if no number

Question 5 Simple Programming Problems using Python

Note: maximum award of 10 marks.

A positive whole number n> 2 is prime if no number between 2 and n (inclusive) evenly divides n. Write a program that accepts a value of n as input and determines if the value is prime. If n is not prime, the program should quit as soon as it finds a value that evenly divides n.

Do the following to document your work:

  • Name your program file using your college ID number, followed by the question number and then your firstname, separated by a dash. Example: 123456_Q5_Talal.py
  • Show your code, with appropriate comments
  • At least two screenshots of the outputs for two different prime numbers as input, with appropriate labels and a short explanation.
  • Screenshot of the output, given a non-prime number as input, with a short explanation.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!