We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 9007d33 commit 7e885e3Copy full SHA for 7e885e3
3 files changed
03_challenge/03_challenge.py
@@ -0,0 +1,26 @@
1
+"""
2
+We will use this script to teach Python to absolute beginners
3
+The script is an example of Fizz-Buzz implemented in Python
4
+
5
+The FizzBuzz problem:
6
+For all integers between 1 and 99 (include both):
7
+ # print fizz for multiples of 3
8
+ # print buzz for multiples of 5
9
+ # print fizzbuzz for multiples of 3 and 5"
10
11
12
+def fizzbuzz(max_num):
13
+ "This method implements FizzBuzz"
14
+ # Google for 'range in python' to see what it does
15
+ for i in range(1,max_num):
16
+ # % or modulo division gives you the remainder
17
+ if i%3==0 and i%5==0:
18
+ print(i,"fizzbuzz")
19
+ elif i%3==0:
20
+ print(i,"fizz")
21
+ elif i%5==0:
22
+ print(i,"Buzz")
23
24
+#----START OF SCRIPT
25
+if __name__=='__main__':
26
+ fizzbuzz('16')
03_challenge/03_readme.md
03_challenge/03_string_to_integer.png
7.62 KB
0 commit comments