Sunday, March 10, 2013

Python FizzBuzz oneliner soluton

Solution-1
for x in range(100):print x%3/2*'Fizz'+x%5/4*'Buzz'or x+1
"""These one liners are not preferred,can be used when min num chars are to be used(when ur being graded based 
on nums of chars"""
Solution-2

for i in range(1,101):print"FizzBuzz"[i*i%3*4:8--i**4%5]or i


Learn python for fun.The popular blog with questions and answers to the python.Solutions to facebookhackercup,codejam,codechef.The fun way to learn python with me.Building some cool apps.

No comments:

Post a Comment