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

Silu

Kirjeldus: Leia ja paranda vead.
Lahenduskeskkond: Olenevalt ülesande keerukusest lahendatakse kasutades arenduskeskkonda või arvutit jt abivahendeid kasutamata.

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

  • Leia koodis viga ja paranda see.
  • Leia koodis viga ja paranda see.
    temperatuurid = [0, 1, 3, 1, 0, -1, 0, 2, 3]
    for temperatuurid in el:
        if el <= 0:
            print(el)
  • Paranda koodi, et see annaks oodatava vastuse.
  • Paranda koodis olevaid numbreid nii, et kui jarjend=[1,2,3,4,5], siis programm annab vastuseks [1, 2, 3].
    jarjend2 = jarjend[-2:-5]
    print(jarjend2)
  • Õpitud ’’smelly code’’ parandamine.
Näiteks on vaja parandada muutujate nimesid, muuta koodi paigutust, eemaldada üleliigseid koodiridasid jne.
  • Korrasta kood.
    while True:
        1nimi = input("Sisesta nimi: ")
        Vanus = input("Sisesta vanus: ")
        if Vanus.isnumeric() == True: break
            Vanus = int(Vanus)
        sünnikuupäev = input("Sisesta sünnikuupäev: ")
        print("Siseta vanus täisarvuna!")
    
    print(1nimi, 'tohib vaadata filmi "A Quiet Place":', Vanus>12)
  • 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