First Program & Variables
Python is a high-level, interpreted, object-oriented, general-purpose language created by Guido van Rossum. Its popularity in engineering comes from its simple syntax, powerful libraries, and direct applicability to scientific computing and AI.
Let's write our first program! In your VS Code, Spyder, or py3roid, type:
print("Hello, I can write program!!")
Congratulations — you are officially a programmer now! 🎉
Now, dear engineers, let's move forward together. Put a piece of paper in front of you and imagine you're solving a civil engineering problem. How would you define parameters on paper? Obviously, with variables:
- Only English letters, digits, and underscore
_are allowed - Cannot start with a digit (
2name❌ —name2✅) - Case-sensitive (
Age≠age) - Avoid reserved keywords such as
ifandfor
# Integer variable
x = 5
y = 10
# String variable
name = "Shayan"
# Float variable
pi = 3.14
print(x) # 5
print(name) # Shayan
Shayan
Basic data types: (click the cards)
5, -3, 1000 — no decimals3.14, -0.5 — written with a dot"Hello" or 'Hi'True or False — equivalent to 1 and 0