PYTHON Tutorial



SYNTAX IN PYTHON


✍️ Python Syntax

Python syntax refers to the set of rules that define how a Python program is written and interpreted. It is known for being clean and easy to understand.

πŸš€ Simple Example

print("Welcome to Python!")
  

This is a simple print statement. No semicolons, no curly braces β€” just readable code!

πŸ“ Indentation Matters

In Python, indentation is not just for readability β€” it defines blocks of code!

if 5 > 2:
    print("5 is greater than 2")
  

⚠️ Don’t use curly braces { }. Use consistent spaces or tabs.

πŸ—£οΈ Comments in Python

You can add comments to explain your code. Python ignores them.

# This is a comment
print("Hello!")  # This is an inline comment
  

πŸ”‘ Case Sensitivity

Python is case-sensitive.

myVar = 10
MyVar = 20
print(myVar)   # Outputs 10
print(MyVar)   # Outputs 20
  

βœ… Python Syntax Rules Summary

  • Indentation is mandatory
  • No curly braces { }, no semicolons needed
  • Comments use #
  • Case sensitive (e.g., age β‰  Age)
  • Each line usually contains one statement
πŸ’‘ Tip: Always maintain proper indentation (typically 4 spaces) β€” it's how Python understands code blocks!

🌟 Enjoyed Learning with Us?

Help others discover Technorank Learning by sharing your honest experience.
Your support inspires us to keep building!

Leave a Google Review