Skip to content

Commit 7395b70

Browse files
committed
Starting For Loop In-Depth
1 parent 0434a28 commit 7395b70

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

basics/For Loop/collection.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
basket = ["Apple", "Banana", "Cherry"]
2+
#for every fruit in basket,
3+
for fruit in basket:
4+
#print the fruit
5+
print(fruit)

basics/For Loop/else.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
basket = ["Apple", "Banana", "Cherry"]
2+
3+
for fruit in basket:
4+
print(f"I ate the {fruit}")
5+
else:
6+
print("The basket is empty")

basics/For Loop/for.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
for x in range(10):
2+
print(x)

0 commit comments

Comments
 (0)