diff --git a/11_challenge/11_challenge.py b/11_challenge/11_challenge.py new file mode 100644 index 0000000..123d406 --- /dev/null +++ b/11_challenge/11_challenge.py @@ -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) diff --git a/11_challenge/11_not_printing_fizzbuzz_for_multiples_of_3_and_5.png b/11_challenge/11_not_printing_fizzbuzz_for_multiples_of_3_and_5.png new file mode 100644 index 0000000..719a0f4 Binary files /dev/null and b/11_challenge/11_not_printing_fizzbuzz_for_multiples_of_3_and_5.png differ diff --git a/11_challenge/11_readme.md b/11_challenge/11_readme.md new file mode 100644 index 0000000..e69de29