Last active
June 17, 2021 18:22
-
-
Save richardpascual/131af3d70f0b45bfb03d0a7286bfba64 to your computer and use it in GitHub Desktop.
Count by 3
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
#Write your function here | |
def every_three_nums(start): | |
cnt = start | |
nums = [start] | |
while cnt < 100: | |
cnt += 3 | |
nums.append(cnt) | |
return nums | |
#Uncomment the line below when your function is done | |
print(every_three_nums(91)) | |
print(every_three_nums(101)) | |
print(every_three_nums(100)) | |
#Alternate solution | |
def every_three_nums(start): | |
return list(range(start, 101, 3)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Added two test cases, in which the code failed. the problem is that there is no initial check if the start value is a valid value (< 100).