What is Syntax?

Syntax is just a fancy word for "The Rules".

Just like English has grammar (periods, commas, capital letters), Python has Syntax. If you break the rules, the robot gets confused! ๐Ÿค–โ“

๐Ÿ“ข
1

Make it Talk (Print)

The first thing to learn! Tell the computer to say something on the screen.

Code:
print("Hello World!")

Don't forget the parentheses ()!

๐Ÿ’ฌ
2

Speech Bubbles (Strings)

Computers don't know what words are. You have to wrap them in quotes.

Code:
"This is a string"
'This works too'

If you forget quotes, it thinks you're talking about a variable!

๐Ÿ“ฆ
3

Memory Boxes (Variables)

Save things for later! Give a name to a value so you can use it again.

Code:
my_name = "Bijees"
score = 100

Now score is a shortcut for 100.

๐Ÿงฎ
4

Super Calculator (Math)

Computers are great at math. You can use them like a calculator.

Code:
print(5 + 5)
print(100 * 2)

Use * for multiply and / for divide.

๐Ÿค”
5

Making Choices (If/Else)

Teach the robot to make decisions based on rules.

Code:
if score > 50:
print("You Win!")
else:
print("Try Again")

โš ๏ธ IMPORTANT: See the indentation (space)? That tells Python what belongs inside the "If".

๐Ÿ”„
6

Looping (Repeat)

Don't be boring! Use a loop to do things over and over again.

Code:
for i in range(5):
print("Jump!")

This counts from 0 to 4 (5 times total). Computers start counting at 0!

๐Ÿ“
7

Secret Notes (Comments)

Sometimes you want to leave a note for yourself that the computer ignores.

Code:
# This is a secret note
print("Hi") # Computer sees this

Use the hashtag # to make a comment.

๐Ÿž
8

Bugs (Errors)

Did the screen turn red? Don't panic! It just means you broke a syntax rule.

Common Mistakes:
  • Forgetting a quote "
  • Forgetting a parenthesis )
  • Forgetting the colon :
  • Messing up the spaces (Indentation)

Read the error message, fix the typo, and try again!

You know the rules. Now play the game!

Start Coding Now ๐Ÿš€