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,

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
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
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education