Skip to content

Instantly share code, notes, and snippets.

@richardpascual
Last active June 17, 2021 18:22
Show Gist options
  • Save richardpascual/131af3d70f0b45bfb03d0a7286bfba64 to your computer and use it in GitHub Desktop.
Save richardpascual/131af3d70f0b45bfb03d0a7286bfba64 to your computer and use it in GitHub Desktop.
Count by 3
#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))
@richardpascual
Copy link
Author

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment