Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def dodanieOceny():
- ilosc = int(input("Ile ocen wprowadzić: "))
- i=0
- while i<ilosc:
- nowaOcena = int(input("Podaj ocenę: "))
- if nowaOcena >=2 and nowaOcena <=5:
- oceny.append(nowaOcena)
- i+=1
- def zaliczenieSemestru():
- i=0
- while i<len(oceny):
- if oceny[i]>=3:
- i+=1
- if i==2:
- print("Student ma zaliczony semestr")
- else:
- print("Student ma nie zaliczony semestr")
- break
- def oblicz_srednia(oceny):
- suma=0
- i=0
- while i<len(oceny):
- suma+=oceny[i]
- i+=1
- srednia = suma/len(oceny)
- print("Średnia studenta wynosi: ", srednia)
- def sortowanie():
- oceny.sort()
- def wyswietlenieOcen():
- print(oceny)
- oceny = []
- dodanieOceny()
- zaliczenieSemestru()
- oblicz_srednia(oceny)
- sortowanie()
- wyswietlenieOcen()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement