Created
December 15, 2021 21:13
-
-
Save GitAlison/24ac5619ff2cc0fe6ad4aa86f8911363 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
#!/usr/bin/env python | |
""" | |
title: Calculate Multple of numbers | |
author: Alison Aguiar | |
date: 15/12/2021 | |
version: 1.0 | |
python version: 3.8.3 | |
usage:python calculate_multiple.py | |
description: program that prints the numbers from 1 to 200 (included). | |
But for multiples of 4 print “xxx” instead of the number, for the multiples of 7 print “yyy”, | |
for numbers which are multiples of both 4 and 7 print “xxxyyy”. | |
""" | |
quantity = 200 | |
for number in range(1, quantity + 1): | |
is_multiple = False | |
if number % 4 == 0 and number % 7 == 0: | |
print('xxxyyy') | |
is_multiple = True | |
else: | |
if number % 4 == 0: | |
print('xxx') | |
is_multiple = True | |
elif number % 7 == 0: | |
print('yyy') | |
is_multiple = True | |
if not is_multiple: | |
print(number) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment