Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)
Paste
Pasted as Plain Text by ash ( 13 years ago )
def playFizzbuzz(n):
""" Displays the list of first n answers to the Fizzbuzz game """
a = []
for x in xrange(1,int(n)+1):
if(x%3 == 0 and x%5 == 0):
a.append(" FizzBuzz! ")
elif(x%3 == 0):
a.append(" Fizz! ")
elif(x%5 == 0):
a.append(" Buzz! ")
else:
a.append(x)
return a
n = raw_input("Enter a number:")
a = playFizzbuzz(n)
print a
Revise this Paste