Menu

[solved]-Write Python Program Asks User Input Integer Program Determines Whether Number Prime Print Q39090193

a) Write a python program that asks the user to input aninteger. The program then determines whether or not the number isprime and prints the result [20 marks]

b) Now write a program to find all the prime numbers less than100.  Store each prime in a list calledprimes.  Print the list of primes after they have allbeen found [20 marks]

Hints:

  • you can use a boolean variable that takes the valueTrue or False. For example:

isPrime = True

isPrime = False

  • when checking if a number is prime you can use this variable tostore the answer, and then afterwards use it like this:

  if (isPrime):

# some code goes here to (a) print a message, or (b)store the number in the list

  • no more hints – the rest is up to you!

Expert Answer


Answer to a) Write a python program that asks the user to input an integer. The program then determines whether or not the number … . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *