Skip to content

Instantly share code, notes, and snippets.

@KingKevin23
Created January 29, 2020 11:34
Show Gist options
  • Select an option

  • Save KingKevin23/672c598de0e70c906294f1819920b87f to your computer and use it in GitHub Desktop.

Select an option

Save KingKevin23/672c598de0e70c906294f1819920b87f to your computer and use it in GitHub Desktop.
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