Question: Write a Python 3 program called cylindervolumecalc.py that accepts user input from the keyboard for the radius and height of the cylinder and outputs the
Write a Python 3 program called cylindervolumecalc.py that accepts user input from the keyboard for the radius and height of the cylinder and outputs the volume based on the equation for the volume of a cylinder provided in the requirements
Challenge: Improved Calculate the Volume of a Cylinder Description: Write a Python 3 program called cylindervolumecalc.py that accepts user input from the keyboard for the radius and height of the cylinder and outputs the volume based on the equation for the volume of a cylinder provided in the requirements The program is to handle exceptions and not crash based on user input. A negative radius and/or height are not to be accepted from the user. And, after each calculation the user is to be prompted if they want to perform another calculation. Purpose: Provide experience with writing an interactive Python program that accepts input, performs a calculation, then displays the result as output while handling invalid input from the user. It also provides experience with loops and controlling them based on user input. Requirements: This programming challenge begins with the program you wrote for the Calculate the Volume of a Cylinder challenge and incorporates additional requirements. Here are the requirements from the original challenge: Write a Python 3 program called cylindervolumecalc.py that accepts user input from the keyboard for radius and height of a cylinder and outputs the volume based on the following equation. V=nrih The volume of a cylinder is 1 (3.14159) times the radius squared times the height of the cylinder. The following are additional requirements for this challenge: User input may not cause the program to crash. Exceptions from invalid user input must be handled gracefully. The user is to be given feedback about invalid input and given the opportunity to supply the input without needing to run the program again. Negative values for radius and height are not to be accepted from the user. If a negative value is provided the user is to be given feedback and asked again for the value. After each calculation the user is to be prompted if they want to perform another calculation. If they answer with a "y" then they are to be prompted for new input and another calculation is to be performed. If they provide any other response the program is to exit
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
