+ 1
Write solution in Python or js
given a positive integer N prints numbers from 1to N...but if a No. is divisible by 3,5,7 its replaced by fizz, buzz, woof respectively. If a No is divisible by more than one of the numbers it should be replaced by a concatenation of the respective words fizz, buzz, woof in this order eg 15 is replaced by fizzbuzz and numbers divisible by 3,5 and 7 should be replaced by fizzbuzzwoof
5 Respuestas
+ 10
There is one for example:
https://code.sololearn.com/cp92Xzx7q4iQ/?ref=app
+ 9
There, I made a new one with explanations:
https://code.sololearn.com/cnohYAdJ69ik/?ref=app
+ 6
There already is such a code here on SL. Try searching for it.
+ 1
I haven't seen it
+ 1
for i in range (1,200):
if i%3==0 and i%5==0 and i%7==0:
print 'FizzBuzzWoof'
elif i%3==0 and i%5==0 and i%7!=0:
print 'FizzBuzz'
elif i%3!=0 and i%5==0 and i%7==0:
print 'BuzzWoof'
elif i%3==0 and i%5!=0 and i%7!=0:
print 'Fizz'
elif i%3!=0 and i%5==0 and i%7!=0:
print 'Buzz'
elif i%3!=0 and i%5!=0 and i%7==0:
print 'Woof'
else:
print i
#this works as well...but its python 2.7