Introduction

Gal Normal

I've learned some basic programming concepts. What's next?

Geek Curious

Now you can explore intermediate concepts like loops and conditional statements!

Gal Excited

That sounds fun! Teach me!

Geek Smiling

Alright, let's dive into intermediate concepts using Python.

Step 1: Conditional Statements

Gal Eager

First, tell me about conditional statements!

Geek Explaining

Conditional statements are used to make decisions in code. They use "if," "elif," and "else" keywords.

age = 15

if age < 13:
    print("You're a child.")
elif age < 18:
    print("You're a teenager.")
else:
    print("You're an adult.")

Output:

You're a teenager.

Step 2: Loops

Gal Wondering

What about loops? How do they work?

Geek Ready

Loops are used to repeatedly execute a block of code. There are two types of loops: "for" loops and "while" loops.

For loop:

for i in range(5):
    print(i)

Output:

0
1
2
3
4

While loop:

counter = 0

while counter < 5:
    print(counter)
    counter += 1

Output:

0
1
2
3
4

Conclusion

Congratulations! You’ve learned intermediate programming concepts like conditional statements and loops. These concepts will help you create more advanced programs and solve complex problems. Keep practicing and have fun! 🎉