Understanding Print Functions, Variables, and Naming in Programming
Learning Python starts with mastering **print functions, variables, and proper naming conventions**. These form the foundation of structured programming.
1. The Print Function
The print()
function displays output to the screen. It helps programmers **show messages, debug values**, or interact with users.
print("Hello, World!")
You can print multiple items:
name = "Arko"
age = 20
print("My name is", name, "and I am", age, "years old.")
2. Variables in Programming
Variables **store data** that can be reused. They help organize and manipulate information efficiently.
user_name = "Arko"
user_age = 20
Variable Types:
num = 10
→ Integerpi = 3.14
→ Floatmessage = "Welcome"
→ Stringis_active = True
→ Boolean
3. Proper Naming Conventions
Proper naming makes **code readable and understandable**.
✅ Valid Variable Names:
user_name
→ Uses underscoresage25
→ Numbers are allowedprice_per_item
→ Descriptive naming
❌ Invalid Variable Names:
2years
→ Can't start with a numberuser-name
→ Hyphens not allowedclass
→ Reserved Python keyword
Tip: Always use **clear, meaningful variable names** to improve readability.
Conclusion
- ✔
print()
function is **used to display output**. - ✔ **Variables store and manage data efficiently**.
- ✔ **Naming conventions ensure clean, readable code**.
Master these **core programming concepts** and build solid foundations in Python! 🚀