Created
October 3, 2013 19:40
-
-
Save diegorocha/6815837 to your computer and use it in GitHub Desktop.
Desafio #1 da Globo.com na Python Brasil [9]
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 | |
# -*- coding: utf-8 -*- | |
""" | |
Provavelmente existe a 3ª exceção: | |
Quando o número for múltiplo de 3 e 5 escrever 'ping pong' em vez do número. | |
""" | |
n = 1 | |
while n < 101: | |
m3 = (n % 3 == 0) | |
m5 = (n % 5 == 0) | |
if m3 or m5: | |
if m3: | |
print 'ping', | |
if m5: | |
print 'pong', | |
else: | |
print n | |
n += 1 | |
#Vou ficar devendo os testes :-( |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment