Skip to content

Commit

Permalink
Added challenge 11, fizzbuzz is not printed (#7)
Browse files Browse the repository at this point in the history
* Added challenge 11, fizzbuzz is not printed

* Updated for error message

* Updated error message

Looks good @raddhakrishnan - thank you!
  • Loading branch information
raddhakrishnan authored and qxf2 committed Oct 23, 2018
1 parent f231046 commit 6d193b8
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions 11_challenge/11_challenge.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
"""
We will use this script to teach Python to absolute beginners
The script is an example of Fizz-Buzz implemented in Python
The FizzBuzz problem:
For all integers between 1 and 99 (include both):
# print fizz for multiples of 3
# print buzz for multiples of 5
# print fizzbuzz for multiples of 3 and 5"
"""

def fizzbuzz(max_num):
"This method implements FizzBuzz"
# Google for 'range in python' to see what it does
for i in range(1,max_num):
# % or modulo division gives you the remainder
if i%3==0:
print(i,"fizz")
elif i%5==0:
print(i,"Buzz")
elif i%3==0 and i%5==0:
print(i,"fizzbuzz")

#----START OF SCRIPT
if __name__=='__main__':
fizzbuzz(100)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file added 11_challenge/11_readme.md
Empty file.

0 comments on commit 6d193b8

Please sign in to comment.