Homework 7
The deadline is Sunday, the 25th of October, 23:59 (Estonian time).
NB! Make sure that the text files (.txt) are in the same folder as your Python code. Otherwise Python will not find the file.
Exercise 1. Celsius and Fahrenheit
Create the text file temps.txt. In the file, write temperatures in Celsius (each value on a separate line). Create a program which reads temperatures from a file (that contains temperatures in Celcius), converts the temperatures to Fahrenheit and stores the converted temperatures into a list (Hint: you can use the function we wrote in one practice session to convert from Celcius to Fahrenheit). The program should print out the average, maximum and minimum of the Fahrenheit temperatures.
Exercise 2. Number of days in months
Rewrite the number of days in months program so that the program prompts the user for the file name and reads the dates from the file. The dates in the file are written in the format dd.mm.yyyy (see an example). The program looks for the month in each line (hint: use split) and prints out the number of days in that month. Rewrite the function so that it does not contain conditional (if) statements for returning the number of days. The function should do it using a list (look at example code 2). Do not add the check for a leap year (let’s say that there are 28 days in February).
Go to Moodle and upload your solution into Homework 7.