Arvutiteaduse instituut
  1. Kursused
  2. 2018/19 sügis
  3. Programmeerimine (Narva Kolledž) (SVNC.00.054)
EN
Logi sisse

Programmeerimine (Narva Kolledž) 2018/19 sügis

  • Home
  • Grading
  • Links

During session 1

slides1.pdf

Exercises

1. Welcome

Write a program that prompts you for your name, and then welcomes you by the name. Use input.

 Enter your name: Chuck
 Hello Chuck

2. ECTS and hours

Write a program that asks the user about the ECTS and the duration of the present course in weeks. The program has to output the hours per week outlined in this course. (1 ECTS is 26 hours)

3. Celsius and Fahrenheit

Write a program which prompts the user for a temperature in Celsius. The program has to convert the temperature into the Fahrenheit scale and print the computed value out.

4. Values and types

Assume that we execute the following assignment statements:

width = 17
height = 12.0

For each of the expressions below, write the value of the expression and the type (of the expression value).

  1. width/2
  2. width/2.0
  3. width//2
  4. width//2.0
  5. width%2
  6. height/3
  7. 1 + 2 * 5

Use the Python interpreter to check your answers.

5. Shoe size

Write a program that prompts the user for his name and actual foot size in cm. The program has to compute and output a suitable shoe size (use the following formula: shoe size = 1.5 * (foot length + 1.5)). Round the answer (you can use round for that, e.g. round(2.5) returns 3).

 Enter your name: Marina
 Enter your foot size (cm): 23.5
 Dear Marina, your suitable shoe size is 38.
  • 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