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
class Musician(object): | |
def __init__(self, sounds): | |
self.sounds = sounds | |
def solo(self, length): | |
for i in range(length): | |
print(self.sounds[i % len(self.sounds)], end=" ") | |
print() | |
class Bassist(Musician): # The Musician class is the parent of the Bassist class |
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
n = raw_input("Upper limit: ") | |
n = int(n) | |
for i in range(1,n): | |
if i % 3 == 0 and i % 5 == 0: | |
print 'fizz buzz' | |
elif i % 5 == 0: | |
print 'buzz' | |
elif i % 3 == 0: | |
print 'fizz' |
NewerOlder