Write a solution using Python to each of the following math problems. For each solution, be sure to include:
- A descriptive program header, written as a multi-line comment. Follow the example style in the template.
- Proper naming of variables. (See this documentation.)
- Comments to document your code.
- User-friendly input prompts.
Write a program circumference.py that gets the radius of a circle from user input, then computes and outputs the circumference. Use the formula
Circumference Calculator
Enter Radius: 12.3
Result: Circumference is 77.2
Write a program exponent.py that gets two numbers from user input,
Exponent Calculator
Enter Base (a): 2
Enter Power (b): 8
Result: a^b is 256
Write a program rads.py that gets a number from user input in degrees, then converts and outputs the equivalent value in radian measure. Use the formula
Radian Calculator
Enter Degrees: 45
Result: 45 degrees is 0.785 radians
Write a program celsius.py that gets a temperature from user input in Fahrenheit, then outputs the equivalent value in Celsius. Use the conversion formula
Fahrenheit to Celsius Converter
Enter Temperture in Fahrenheit: -40
Result: -40°F is -40°C
Write a program kilometres.py that gets a distance from user input in miles, then outputs the equivalent value in kilometres. Use the conversion formulas
Miles to Kilometres Calculator
Enter Distance in Miles: 55
Result: 55 miles equals 88.5 km
Write a program hours.py that gets a number of hours from user input, then converts it into days and hours. For example, 111 hours would equal 4 days, 15 hours.
Hours to Days Calculator
Enter Duration in Hours: 111
Result: 111 hours is equal to 4 days, 15 hours
Write a program sphere.py that gets the radius of a sphere from user input, then computes and outputs the volume of the sphere. Use the formula
Sphere Volume Calculator
Enter Radius: 12.3
Result: Volume is 7795
Write a program investment.py that calculates the future value of an investment. Prompt the user for (1) the principal amount, (2) annual interest rate as a decimal (e.g. input 0.06 for
Where:
-
$FV$ is the future value of the investment -
$P$ is the principal amount -
$r$ is the annual interest rate, expressed as a decimal -
$n$ is the number of years the investment is held
Investment Future Value Calculator
Enter Principal Amount: 25000.00
Enter Annual Interest Rate: 0.0595
Enter Number of Years: 2
Result: Future Value of investment is 28063.51