Arvutiteaduse instituut
  1. Kursused
  2. 2022/23 sügis
  3. Programmeerimise alused (MTAT.03.236)
EN
Logi sisse

Programmeerimise alused 2022/23 sügis

  • Home
  • Grading
  • Links

Homework 7

The deadline is Thursday, the 20th 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 7.1 Failing students

Create the file students.txt containing student names, study book numbers and points (out of 100) that they got in the class. Use ", " as a separator.

students.txt content:

 Benjamin Hummel, B82234, 40
 Janus Alberink, B82694, 95
 Alexandra Peppi, B95274, 50

Create a program that reads data from the file and returns the data about students who failed the course (got less than 51 points).

The output of the program should be:

>>> %Run solution.py
Benjamin Hummel, B82234, 40
Alexandra Peppi, B95274, 50

If you have been struggling with this exercise for some time, maybe you can get help from troubleshooter: https://progtugi.cs.ut.ee#/ts/623af300ef7eaf5634394bf4/. It tries to explain the most common problems and give hints.

Exercise 7.2 US height and weight 2

Write a program that reads people’s height in cm and weight in kg from stats.txt file, converts them to US units of measurement (feet and lb) and then outputs them. You can use the following ratios for your calculations: 1cm = 0.0328ft and 1kg = 2.20lb. Round the results to 1 decimal.

stats.txt content:

 170cm, 60kg
 190cm, 95kg
 160cm, 65kg
 180cm, 75kg

The output of the program should be:

>>> %Run solution.py
5.6ft, 132.0lb
6.2ft, 209.0lb
5.2ft, 143.0lb
5.9ft, 165.0lb

If you have been struggling with this exercise for some time, maybe you can get help from troubleshooter: https://progtugi.cs.ut.ee#/ts/623af5c2ef7eaf5634394c33/. It tries to explain the most common problems and give hints.

Go to Moodle and put your solutions into Exercises 7.

  • Arvutiteaduse instituut
  • Loodus- ja täppisteaduste valdkond
  • Tartu Ülikool
Tehniliste probleemide või küsimuste korral kirjuta:

Kursuse sisu ja korralduslike küsimustega pöörduge kursuse korraldajate poole.
Õppematerjalide varalised autoriõigused kuuluvad Tartu Ülikoolile. Õppematerjalide kasutamine on lubatud autoriõiguse seaduses ettenähtud teose vaba kasutamise eesmärkidel ja tingimustel. Õppematerjalide kasutamisel on kasutaja kohustatud viitama õppematerjalide autorile.
Õppematerjalide kasutamine muudel eesmärkidel on lubatud ainult Tartu Ülikooli eelneval kirjalikul nõusolekul.
Tartu Ülikooli arvutiteaduse instituudi kursuste läbiviimist toetavad järgmised programmid:
euroopa sotsiaalfondi logo