Institute of Computer Science
  1. Courses
  2. 2020/21 fall
  3. Introduction to Programming II (MTAT.03.256)
ET
Log in

Introduction to Programming II 2020/21 fall

  • Home
  • Grading
  • Links

Homework 4

The deadline is Sunday, the 6th of December, 23:59 (Estonian time).

Exercise 1. Traffic sign

Choose a traffic sign (examples: https://en.wikipedia.org/wiki/Traffic_sign). Write a program that uses tkinter and its widget canvas to draw the traffic sign in the window with a white background. The title of the window has to be "Traffic Sign".

Exercise 2. Username from url

At the University of Tartu, every user of the Study Information System (a student or a member of staff) has his/her home directory. The user can create a webpage on the university server. The url for his/her webpage would be http://www.ut.ee/~username/ (e.g. http://www.ut.ee/~vilo/).

Write a program that prompts the user for a file name. The program has to read the file line by line, look for the user names (using regular expressions) and print the names out.

If the file urls.txt contains the following lines:

 http://www.ut.ee/~koit/KT/index_eng.html
 Lecture lasts ~90 minutes
 http://www.ut.ee/~vilo/
 http://www.ut.ee/~kiho/
 "x ~ y" means that x and y are of the same order of magnitude

then the output of the program has to be

 Please enter a file name: urls.txt
 The user names are:
 koit
 vilo
 kiho

Go to Moodle and upload your solution into Homework 4.

  • Institute of Computer Science
  • Faculty of Science and Technology
  • University of Tartu
In case of technical problems or questions write to:

Contact the course organizers with the organizational and course content questions.
The proprietary copyrights of educational materials belong to the University of Tartu. The use of educational materials is permitted for the purposes and under the conditions provided for in the copyright law for the free use of a work. When using educational materials, the user is obligated to give credit to the author of the educational materials.
The use of educational materials for other purposes is allowed only with the prior written consent of the University of Tartu.
Terms of use for the Courses environment