Created
January 27, 2021 06:06
-
-
Save kat-perreira/55a6f1062e62ca4c1dbbc058f9314562 to your computer and use it in GitHub Desktop.
While loop practice
This file contains 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
# while something is true, do the thing | |
# print all numbers that are less than 5 | |
def less_than_5(): | |
thing_to_return = [] | |
i = 0 # set something to less than 5 () | |
while i < 5: | |
thing_to_return.append(i) | |
i += 1 | |
print(thing_to_return) | |
return thing_to_return | |
if less_than_5() == [0,1,2,3,4]: | |
print("passed") | |
else: | |
print("try again!") | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment