1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Nonamiya [84]
3 years ago
5

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.
here is a full explanation
• In order to do this, you will need to write a program containing two functions: • The function main() • The function isprime(arg) which tests the argument (an integer) to see if is Prime or Not.
step1 •
The following is a description of what each function should do: • main() will be designed to do the following: • On the first line you will print out: "My Name’s Prime Number Checker" • You will ask that an integer be typed in from the keyboard. • You will check to be sure that the number (num) is equal to or greater than the integer 2. If it isn’t, you will be asked to re-enter the value. • You will then call the function isprime(num), which is a function which returns a Boolean Value (either True or False). • You will then print out the result that the function returned to the screen, which will be either: • If the function returned True, then print out num "is Prime", or • If the function returned False, then print out num "is Not Prime". • Your entire main() function should be contained in a while loop which asks you, at the end, if you would like to test another number to see if it is Prime. If you type in "y", then the program runs again. • isprime(arg) will be designed to do the following: • It will test the argument sent to it (nuM in this case) to see if it is a Prime Number or not. • The easiest way to do that is to check to be sure that it is not divisible by any number, 2 or greater, which is less than the value of nuM. • As long as the modulo of nuM with any number less than it (but 2 or greater) is not zero, then it will be Prime, otherwise it isn’t. • Return the value True, if it is Prime, or False if it is not Prime.
step 2 • This exercise assumes that you have already written the isprime function, isprime(arg), in Homework-5A. • Write a program called: YourNameHwrk5B.py, that displays all the prime numbers from 2 to whatever integer that you type in. • Your main() function should start by printing your name at the top of the display (e.g. "Charlie Molnar’s Prime Number List") • This program should have a loop that calls the isprime() function, which you include below the function main().
Computers and Technology
1 answer:
Advocard [28]3 years ago
4 0

Answer:

I need some time i answering your question please follow me and thank(sanybody have any friends cute girl or cute sardarni he is my classmate His name Was Kushi ask to Please follow me)

You might be interested in
Someone help me out eh?
Elodia [21]

Line 4

It should be font-size: 15px

Also there should be curly braces in line 5.

6 0
3 years ago
Read 2 more answers
What two choices do you have when you open the Remote tab of the System Settings?
andre [41]

Answer:

remote assistance and remote desktop

Explanation:

^

4 0
3 years ago
Several surprising findings were revealed in the wake of the Target breach, providing a cautionary tale for all executives and s
Akimi4 [234]

Answer: (a) Target had security software, but the notification alerts from the software were  ignored.

Explanation:

The security software was there in target but its notification alerts being ignored was something which was not thought to have been occurred during the Target security breach, as anyone could be alerted with the notification alert.

6 0
3 years ago
Why is the choice of form factor critical when building a computer from scratch?
faltersainse [42]
More features/more space makes things easier to work on and cool down
6 0
3 years ago
Which element of the word window is to the right of the screen
sesenic [268]

Answer: task pane

Using the task pane When opened, the task pane will appear on the right side of the Word window. The task pane provides easy access to commonly used menus, buttons, and tools.

Hope this helps....... Stay safe and have a Merry Christmas!!!!!!!!! :D

7 0
3 years ago
Read 2 more answers
Other questions:
  • Danny is editing the text content of a single page on a website he created a year ago. What part of the tag would he have to upd
    11·1 answer
  • What are short handled screwdrivers used for?
    12·1 answer
  • Katie wants to use VLOOKUP for a column in a table. Which value of the mode parameter should she use to look for an exact match
    7·1 answer
  • Write a function checkPalindrome that accepts a single argument, a string. The function should return true (Boolean) if the stri
    15·1 answer
  • An assignment notebook works in conjunction with
    7·2 answers
  • Briefly tell me what a PUT request does
    11·1 answer
  • Which among the following choices is correct based on the two statements listed below? Statement 1: When the lexical analyzer sc
    12·1 answer
  • Define the html code to insert a heading
    14·1 answer
  • Iam trying to find a way to code in Scratch that will let me take away the first two and last two letters of a word. For example
    15·1 answer
  • What do you believe the year 2058 will be like? Reply with a link or a picture along with an explanation why. There should be a
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!