Skip to content

Commit 0cc80be

Browse files
committed
Add 10_if_statements
1 parent 1a824f1 commit 0cc80be

File tree

6 files changed

+64
-0
lines changed

6 files changed

+64
-0
lines changed

10_if_statements/1_statements.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Simple code lines in your programs are instructions
2+
# You instruct Python to do something specific
3+
4+
a = 4
5+
6+
2 < 3

10_if_statements/2_if.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Flow Control
2+
3+
# temperature = 30
4+
# print("The weather is 😎")
5+
6+
# TASK: Decide ⛅ is 🥶 or 😎
7+
8+
# if condition:
9+
# statement(s)
10+
11+
temperature = 10
12+
13+
if temperature >= 18:
14+
print("The weather is 😎")
15+
if temperature < 18:
16+
print("The weather is 🥶")

10_if_statements/3_indentation.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
temperature = 20
2+
3+
if temperature >= 18:
4+
print("The weather is warm")
5+
print("😎")
6+
7+
print("...")

10_if_statements/4_nested_if.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
temperature = 31
2+
3+
if temperature >= 18:
4+
print("The weather is 👍")
5+
if temperature > 30:
6+
print("The weather is 😎")
7+
8+
print("⛅")

10_if_statements/5_if_else.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
temperature = 17
2+
3+
if temperature >= 18:
4+
print("The weather is 😎")
5+
else:
6+
print("The weather is 🥶")
7+
8+
# Form
9+
10+
# if condition:
11+
# statement(s)
12+
# else:
13+
# statement(s)
14+
15+
# ? 🥶

10_if_statements/6_if_elif_else.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# elif -> else if
2+
3+
temperature = 3
4+
5+
if temperature >= 30:
6+
print("The weather is 😎")
7+
elif temperature > 20:
8+
print("The weather is 👍")
9+
elif temperature > 10:
10+
print("The weather is 👎")
11+
else:
12+
print("The weather is 🥶")

0 commit comments

Comments
 (0)