Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
Bartleby Related Questions Icon

Related questions

Question
Please I would like a zoomed out picture of the code. I had to send this twice cause the last one was blurry and the paper was blank.IN PYTHON PLEASE
Problem 3 (Ceiling or Floor)
Write a program called p3.py that has the following functionality:
1. Add a main() function to your program and create a one-dimensional list (empty to
start) in this function.
2. Prompt the user to enter a number (int or float, validation is not required).
3. Add the user input to the empty list as a float.
4. Continue steps 2 and 3 until the user enters 'q' or 'Q'.
5. Print all numbers stored in the list.
6.
Ask the user if they would like the ceiling or the floor values of all the numbers. The
user should enter 'c' for ceiling and 'f' for floor. The input should be validated and if
incorrect, the user should be prompted again.
7. The program should print each of the ceilings/floors of the numbers in the list, making
use of the ceil() and floor() functions from the math module (you can check this link
know more about
ceil and floor functions in python
https://docs.python.org/3/library/math.html).
to
8. Try to write helper functions to do certain functionality where it makes sense and call
those functions in the main() to execute the entire program.
Hints: try to write at least three functions to (i) take inputs until the user decides to
quit, (ii) print the ceil values of the numbers stored in the list, and (iii) print the floor
values of the numbers stored in the list. Make sure to use the necessary parameter(s)
in each function definition and call these functions with appropriate argument(s).
9. Include the guard for the main function:
if
1
name
main':
main ()
Sample output:
Enter a number: 43.2
Enter a number: 95
Enter a number: 2.9
Enter a number:
List contains the following numbers:
43.2
95.0
2.9
Ceiling (c) or floor (f) ? £
43
95
2
Page 4 of 4
4/4
200
expand button
Transcribed Image Text:Problem 3 (Ceiling or Floor) Write a program called p3.py that has the following functionality: 1. Add a main() function to your program and create a one-dimensional list (empty to start) in this function. 2. Prompt the user to enter a number (int or float, validation is not required). 3. Add the user input to the empty list as a float. 4. Continue steps 2 and 3 until the user enters 'q' or 'Q'. 5. Print all numbers stored in the list. 6. Ask the user if they would like the ceiling or the floor values of all the numbers. The user should enter 'c' for ceiling and 'f' for floor. The input should be validated and if incorrect, the user should be prompted again. 7. The program should print each of the ceilings/floors of the numbers in the list, making use of the ceil() and floor() functions from the math module (you can check this link know more about ceil and floor functions in python https://docs.python.org/3/library/math.html). to 8. Try to write helper functions to do certain functionality where it makes sense and call those functions in the main() to execute the entire program. Hints: try to write at least three functions to (i) take inputs until the user decides to quit, (ii) print the ceil values of the numbers stored in the list, and (iii) print the floor values of the numbers stored in the list. Make sure to use the necessary parameter(s) in each function definition and call these functions with appropriate argument(s). 9. Include the guard for the main function: if 1 name main': main () Sample output: Enter a number: 43.2 Enter a number: 95 Enter a number: 2.9 Enter a number: List contains the following numbers: 43.2 95.0 2.9 Ceiling (c) or floor (f) ? £ 43 95 2 Page 4 of 4 4/4 200
Expert Solution
Check Mark
Knowledge Booster
Background pattern image
Computer Science
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
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education