Arvutiteaduse instituut
  1. Kursused
  2. 2020/21 sügis
  3. Programmeerimise alused II (MTAT.03.256)
EN
Logi sisse

Programmeerimise alused II 2020/21 sügis

  • Home
  • Grading
  • Links

Homework 3

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

Exercise 1. Birthdays

Modify the birthdays program : the program should output top 5 months that have the most birthdays.

Exercise 2. Distances between points

Write a function coordinates that has one argument - point_name. The function has to prompt the user for x and y coordinates of the point and return the coordinates in a tuple.

Write a function distance that takes four coordinates (two coordinates for each point) as its arguments and returns the distance between two points. Hint:

Write a program that asks the user for the coordinates of three points (A, B, C) using function coordinates, finds out and outputs two points that are the closest to each other (use function distance) (you can assume that all distances are different).

Here is an example of the program output:

 Please enter point A x coordinate: 0
 Please enter point A y coordinate: 0
 Please enter point B x coordinate: 3
 Please enter point B y coordinate: 2
 Please enter point C x coordinate: 8
 Please enter point C y coordinate: 9
 Points A and B are the closest to each other.

Go to Moodle and upload your solution into Homework 3.

  • 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.
Courses’i keskkonna kasutustingimused