Created
March 8, 2023 13:36
-
-
Save kspar/4dea6170c8e326b7ba1343638fdb7fd5 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
def tagastab_listi(): | |
return [42, 57] | |
# tagastusväärtus sisaldab nüüd funktsiooni tagastatud väärtust (listi) | |
# Sellega võib ükskõik mida teha | |
tagastusväärtus = tagastab_listi() | |
# Väljasta tagastatud väärtus lihtsalt listina | |
print(tagastusväärtus) | |
# Väljasta tagastatud listi väärtused ükshaaval | |
for asi in tagastusväärtus: | |
print(asi) | |
# Väljasta tagastatud listi väärtused järjekorranumbritega | |
i = 0 | |
while i < len(tagastusväärtus): | |
print(i, tagastusväärtus[i]) | |
i += 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment