Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/python3
- def PodawanieOcen():
- a = int(input("Podaj liczbe 2: "))
- b = int(input("Podaj liczbe 3: "))
- c = int(input("Podaj liczbe 4: "))
- d = int(input("Podaj liczbe 5: "))
- lista_ocen = [a, b, c, d]
- return lista_ocen
- def SredniaOcen(oceny):
- suma = 0
- liczba_ocen = sum(oceny)
- for i in range(len(oceny)):
- suma += (i+2) * oceny[i]
- srednia = float(suma) / float(liczba_ocen)
- return srednia
- def Wyswietlanie(oceny, sredniaOcen):
- print("Liczba 2: {}. Liczba 3: {}. Liczba 4: {}. Liczba 5: {}".format(oceny[0], oceny[1], oceny[2], oceny[3]))
- print("Srednia ocen wynosi: {}".format(sredniaOcen))
- def SrednieOceny():
- oceny = PodawanieOcen()
- sredniaOcen = SredniaOcen(oceny)
- Wyswietlanie(oceny, sredniaOcen)
- def main():
- SrednieOceny()
- if __name__=="__main__":
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement