Created
February 2, 2020 23:25
-
-
Save edenau/508e647c8d93f9c42923e8d747548501 to your computer and use it in GitHub Desktop.
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
def test(nums): | |
for i in nums: | |
if i == 0: # if the condition is satisfied, it hits break and the else block will not run | |
print('There is a 0.') | |
break | |
else: | |
print('There are no 0s.') | |
test([1,2,3,0]) # There is a 0. | |
test([1,2,3]) # There are no 0s. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment