Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python
- print('=================> <Fizz Buzz> <=================')
- def fizzBuzz(myList):
- # 3 = Fizz | # 5 = Buzz
- mystring = ''
- for x in myList:
- if x % 3 == 0:
- mystring = 'Fizz'
- if x % 5 == 0:
- mystring += '-buzz'
- if len(mystring.strip()) > 0:
- print('Num: {0} is {1}'.format(x, mystring))
- else:
- print('Neither', x)
- print('Enter max list range: ')
- maxRange = input()
- try:
- x = int(maxRange)
- fizzBuzz(range(1, x))
- except:
- print('Something bad happened')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement