Skip to content

Commit b3f1f85

Browse files
committed
Updated FizzBuzz for post video
1 parent 768182c commit b3f1f85

File tree

2 files changed

+18
-36
lines changed

2 files changed

+18
-36
lines changed

Python_Basics/Intro/.ipynb_checkpoints/PythonBasicsFizzBuzz-checkpoint.ipynb

Lines changed: 11 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@
4747
}
4848
],
4949
"source": [
50+
"# Solution 1\n",
51+
"# Concatenating Strings\n",
5052
"for num in range(1,21):\n",
5153
" string = \"\"\n",
5254
" if num % 3 == 0:\n",
@@ -60,14 +62,13 @@
6062
},
6163
{
6264
"cell_type": "code",
63-
"execution_count": 10,
65+
"execution_count": 12,
6466
"metadata": {},
6567
"outputs": [
6668
{
6769
"name": "stdout",
6870
"output_type": "stream",
6971
"text": [
70-
"FizzBuzz\n",
7172
"1\n",
7273
"2\n",
7374
"Fizz\n",
@@ -92,7 +93,14 @@
9293
}
9394
],
9495
"source": [
95-
"for num in range(0, 21):\n",
96+
"# Solution 2\n",
97+
"# Utilizing if, elif, and else\n",
98+
"\n",
99+
"# an elif statement allows you to check multiple expressions\n",
100+
"# for True and execute a block of code as soon as one of \n",
101+
"# the conditions evaluates to True\n",
102+
"\n",
103+
"for num in range(1, 21):\n",
96104
" if num % 3 == 0 and num % 5 == 0:\n",
97105
" print('FizzBuzz')\n",
98106
" elif num % 3 == 0:\n",
@@ -137,34 +145,6 @@
137145
"source": [
138146
"https://www.youtube.com/watch?v=JqGjkNzzU4s"
139147
]
140-
},
141-
{
142-
"cell_type": "markdown",
143-
"metadata": {},
144-
"source": [
145-
"https://www.quora.com/How-do-I-print-out-odd-and-even-numbers-in-python-using-list-and-loop "
146-
]
147-
},
148-
{
149-
"cell_type": "markdown",
150-
"metadata": {},
151-
"source": [
152-
"https://www.quora.com/How-do-I-find-the-minimum-odd-number-from-a-list-of-numbers-in-Python"
153-
]
154-
},
155-
{
156-
"cell_type": "markdown",
157-
"metadata": {},
158-
"source": [
159-
"https://www.quora.com/In-Python-how-do-I-find-the-total-of-odd-numbers-from-a-list"
160-
]
161-
},
162-
{
163-
"cell_type": "markdown",
164-
"metadata": {},
165-
"source": [
166-
"https://www.quora.com/How-can-I-make-for-loops-work-in-Python"
167-
]
168148
}
169149
],
170150
"metadata": {

Python_Basics/Intro/PythonBasicsFizzBuzz.ipynb

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
},
1717
{
1818
"cell_type": "code",
19-
"execution_count": 9,
19+
"execution_count": 14,
2020
"metadata": {},
2121
"outputs": [
2222
{
@@ -48,6 +48,7 @@
4848
],
4949
"source": [
5050
"# Solution 1\n",
51+
"# Concatenating Strings\n",
5152
"for num in range(1,21):\n",
5253
" string = \"\"\n",
5354
" if num % 3 == 0:\n",
@@ -61,14 +62,13 @@
6162
},
6263
{
6364
"cell_type": "code",
64-
"execution_count": 10,
65+
"execution_count": 15,
6566
"metadata": {},
6667
"outputs": [
6768
{
6869
"name": "stdout",
6970
"output_type": "stream",
7071
"text": [
71-
"FizzBuzz\n",
7272
"1\n",
7373
"2\n",
7474
"Fizz\n",
@@ -94,11 +94,13 @@
9494
],
9595
"source": [
9696
"# Solution 2\n",
97+
"# Utilizing if, elif, and else\n",
98+
"\n",
9799
"# an elif statement allows you to check multiple expressions\n",
98100
"# for True and execute a block of code as soon as one of \n",
99101
"# the conditions evaluates to True\n",
100102
"\n",
101-
"for num in range(0, 21):\n",
103+
"for num in range(1, 21):\n",
102104
" if num % 3 == 0 and num % 5 == 0:\n",
103105
" print('FizzBuzz')\n",
104106
" elif num % 3 == 0:\n",
@@ -118,7 +120,7 @@
118120
},
119121
{
120122
"cell_type": "code",
121-
"execution_count": 23,
123+
"execution_count": 16,
122124
"metadata": {
123125
"collapsed": true
124126
},

0 commit comments

Comments
 (0)