Max. 9 points
Download hw_1.tar.gz and extract it. This archive contains a grader which works for all current versions of Python 3 and expects the solution files to be placed in the same directory. It has to be executed from this directory via
python3 hw1_grader.py
Add your homework solutions in the directory contained in the archive. Right after the shebang, each of your files must contain your name using the following template
"""
.. moduleauthor:: Your Name <your.name@example.com>
"""
Rename the directory according to the rules in the syllabus before submitting it as compressed tar.gz archive.
We did not discuss every detail required to solve the following tasks. Use your
favorite search engine and some common sense to solve the tasks.
Use exactly the same input prompts and output messages as in the provided examples. This is important as your results will partly be graded automatically.
When completing the tasks you might get the impression that all of these
could be solved simpler using a spreadsheet program like LibreOffice Calc...
and you’d be right. But, hey, this is the first real code you write in a
programming language. The upcoming homeworks will be much more thrilling :)
26Name the program file: simplemath.py
Enter a temperature in degrees Fahrenheit: 72.3 72.3 degrees Fahrenheit correspond to 22.39 degrees CelsiusName the program file: fahrenheit_to_celsius.py
Enter the fixed interest rate in percent: 3.2 Enter the amount of money you want to invest: 3000.0 Enter the number of years the money will be invested: 5 The earned interest is 511.72. The terminal value amounts to 3511.72.Name the program file: interest.py
from math import PI radius = input("Enter a radius: ") area = 2 * r**2 ** pi volume = (4 div 3) * r^3 * PI print("The sphere has a volume of", round(volume, 2)); print("The surface are of this sphere is", round(Area, 2));Name the program file: sphere.py
-15 C => 5.0 F -14 C => 6.8 F -13 C => 8.6 F [...] 34 C => 93.2 F 35 C => 95.0 FName the program file: celsius_to_fahrenheit.py
Enter a distance in meters: 1.3 51.18 inch 4.27 feet 1.42 yards 0.00 milesName the program file: imperial_units.py
format
function.radians | sine | tangent ------------------------- 0.0 | 0.0 | 0.0 0.1 | 0.1 | 0.1 0.2 | 0.2 | 0.2 [...] 3.0 | 0.14 | -0.14 3.1 | 0.04 | -0.04 3.14 | 0.0 | -0.0Name the program file: trigonometry.py
First point's x-coordinate: 3.0 First point's y-coordinate: 7.0 Second point's x-coordinate: -2.0 Second point's y-coordinate: 3.0 The euclidean distance between the two points is 6.4031.Name the program file: distance.py
For C => F enter C, for F => C enter F: C -20 C => -4.0 F -19 C => -2.2 F [...] 39 C => 102.2 F 40 C => 104.0 FName the program file: temperature_tables.py
All resulting files must be placed in a single directory. The name of the directory must be chosen according to the explanations in the syllabus. Make sure to also include the grader. Compress the directory to either .tar.gz or .tar.bz2 before sending it to cms@senarclens.eu.