Institute of Computer Science
  1. Main page
  2. Types of programming tasks
ET
Log in

Types of programming tasks

  • Avaleht
  • Tea ja mõista
  • Rakenda ja analüüsi
  • Sünteesi ja hinda

Silu
Rakenda
Modelleeri ja projekteeri
Uuenda

  • Soovitused kontrolltööks
  • Kasutatud materjalid
  • Autorid

Uuenda

Kirjeldus: Kujunda lahendus (näiteks optimeerimise eesmärgil) ümber.
Lahenduskeskkond: Olenevalt ülesande keerukusest lahendatakse kasutades arenduskeskkonda või arvutit jt abivahendeid kasutamata.

Ülesanded:
Näiteülesande nägemiseks/peitmiseks klikka tüübile.

  • Kirjuta kood ümber nii, et selle pikkus on x rida.
  • Vaata progeopik.cs.ut.ee-s harjutust "Miks on ronk nagu kirjutuslaud?"
  • Antud kood kuvab paarisarvud -10st kuni 10ni. Kirjuta kood ümber pikkuse suhtes optimaalsemalt (kuni 2 rida).
    i = -10
    
    while i<=9:
        print(i)
        i += 2
    
    print(i)
  • Leia koodis ebaoptimaalsed osad ja paranda need.3
  • Optimeeri koodi ning ühtlasi paranda muutujate nimed matemaatikamõistetele vastavaks.
    arvud = [5,6,7,8,9,10,11,12,13,14]
    
    #järjendi elementide arv
    elemente = 0
    for i in arvud:
        elemente += 1
    
    #keskmise leidmine
    keskmineIndx = elemente // 2
    elemente = 0
    for i in arvud:
        elemente += 1
        if elemente == keskmineIndx:
            keskmineEl = i
    print(keskmineEl)
  • Optimeeri koodi ning lõpeta programm.
    #krossijooksu finiš
    esimene = input("1. lõpetaja: ")
    teine = input("2. lõpetaja: ")
    kolmas = input("3. lõpetaja: ")
    neljas = input("4. lõpetaja: ")
    viies = input("5. lõpetaja: ")
    kuues = input("6. lõpetaja: ")
    seitsmes = input("7. lõpetaja: ")
    kaheksas = input("8. lõpetaja: ")
    üheksas = input("9. lõpetaja: ")
    kümnes = input("10. lõpetaja: ")
    
    koht = input("Sisesta, mitmendat lõpetajat soovid näha: ")
Siin on vaja asendada mitmeid osasid koodist konkreetsete õpitud funktsioonidega, kuid Transleeri puhul on koodis üks koht, kus saab teha eelkirjeldatud asenduse.
  • 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