Created
January 29, 2020 11:34
-
-
Save KingKevin23/672c598de0e70c906294f1819920b87f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import statistics | |
| def avg(): | |
| daten = [] | |
| ergebnis = 0 | |
| while True: | |
| if daten: | |
| ergebnis = statistics.mean(daten) | |
| temp = yield ergebnis | |
| daten.append(temp) | |
| it = avg() | |
| next(it) | |
| noten = [1.0, 3.0, 2.0, 1.0, 2.0] | |
| for n in noten: | |
| print(it.send(n)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment