Created
April 28, 2020 20:07
-
-
Save roman-on/4c562906167e32a40269347a854164df 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
""" The function gets an integer, end_number. | |
The function returns a list within the numbers 0 through the end_number, | |
with some numbers being replaced by a boom string if they meet one of the following conditions: | |
1. The number is double the number 7. | |
2. The number contains the digit 7.""" | |
EXMP: | |
print(seven_boom(17)) | |
['BOOM', 1, 2, 3, 4, 5, 6, 'BOOM', 8, 9, 10, 11, 12, 13, 'BOOM', 15, 16, 'BOOM'] | |
def seven_boom(end_number): | |
result = [] | |
for num in range(0, end_number+1): | |
if num%7 == 0 or "7" in str(num): | |
result.append('BOOM') | |
else: | |
result.append(num) | |
return (result) | |
def main(): | |
<your code here> | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment