NEEDS TO BE IN PYTHON!: Program Behavior The program will repeatedly read numbers entered by the user and respond accordingly. Below is a sample run of the program. User input is shown in blue. A value of -1 is used as a sentinel value as the indication the user wants to end the program. Your program should include the following functions: get_number - This function reads an integer from the user, validates it, and returns it. The function should reprompt the user as many times as necessary until the user enters a positive integer or the sentinel value. This function accepts no arguments. is_pronic - This predicate function accepts an integer argument and returns True if the argument is a pronic number and False otherwise. The function should check to see if the product of any two consecutive integers between 1 and a max value equals the argument. The max value checked should be the ceiling of the square root of the argument (any consecutive pair past that max value will be greater than the argument and therefore need not be checked). Use the max.ceil and max.sqrt functions. is_perfect - This predicate function accepts an integer argument and returns True if the argument is a perfect number and False otherwise. The function should check to see if the sum of add up all integer divisors of the argument, except itself, equals the argument. main - This function represents the main program. It contains the loop that processes multiple values, calling the other functions as needed. Call the get_number function initially to get the first input value, then loop to process the value and get the next one,

Programming with Microsoft Visual Basic 2017
8th Edition
ISBN:9781337102124
Author:Diane Zak
Publisher:Diane Zak
Chapter4: The Selection Structure
Section: Chapter Questions
Problem 5MQ2: What is the opposite of greater than?
icon
Related questions
Question

NEEDS TO BE IN PYTHON!:

Program Behavior The program will repeatedly read numbers entered by the user and respond accordingly. Below is a sample run of the program. User input is shown in blue. A value of -1 is used as a sentinel value as the indication the user wants to end the program.

Your program should include the following functions:

get_number - This function reads an integer from the user, validates it, and returns it. The function should reprompt the user as many times as necessary until the user enters a positive integer or the sentinel value. This function accepts no arguments.

is_pronic - This predicate function accepts an integer argument and returns True if the argument is a pronic number and False otherwise. The function should check to see if the product of any two consecutive integers between 1 and a max value equals the argument. The max value checked should be the ceiling of the square root of the argument (any consecutive pair past that max value will be greater than the argument and therefore need not be checked). Use the max.ceil and max.sqrt functions.

is_perfect - This predicate function accepts an integer argument and returns True if the argument is a perfect number and False otherwise. The function should check to see if the sum of add up all integer divisors of the argument, except itself, equals the argument.

main - This function represents the main program. It contains the loop that processes multiple values, calling the other functions as needed. Call the get_number function initially to get the first input value, then loop to process the value and get the next one,

 

 

 

 

Enter a positive integer (or -1 to quit): 6
The number 6:
is pronic
is perfect
Enter a positive integer (or -1 to quit): 7
The number 7:
is NOT pronic
is NOT perfect
Enter a positive integer (or -1 to quit): 12
The number 12:
is pronic
is NOT perfect
Enter a positive integer (or -1 to quit): 28
The number 28:
is NOT pronic
is perfect
Enter a positive integer (or -1 to quit): -100
That number is not positive. Please reenter: -4
That number is not positive. Please reenter: 30
The number 30:
is pronic
is NOT perfect
Enter a positive integer (or -1 to quit): -1
Transcribed Image Text:Enter a positive integer (or -1 to quit): 6 The number 6: is pronic is perfect Enter a positive integer (or -1 to quit): 7 The number 7: is NOT pronic is NOT perfect Enter a positive integer (or -1 to quit): 12 The number 12: is pronic is NOT perfect Enter a positive integer (or -1 to quit): 28 The number 28: is NOT pronic is perfect Enter a positive integer (or -1 to quit): -100 That number is not positive. Please reenter: -4 That number is not positive. Please reenter: 30 The number 30: is pronic is NOT perfect Enter a positive integer (or -1 to quit): -1
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Function Arguments
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Programming with Microsoft Visual Basic 2017
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning