🐍 Python Day 4 – Operators
🧠 Introduction
🐍 Python Day 4 – Operators
Ippati varaku manam input & output nerchukunnam.
I roju manam Operators gurinchi nerchukundam.
👉 Operators ante values mida operations cheyadaniki use avuthayi
Example: +, -, *, /
💡 Maths lo use chese symbols laga ne untayi
➕ Arithmetic Operators
<> Python
a = 10
b = 5
print(a + b)
print(a - b)
print(a * b)
print(a / b)
# 15
# 5
# 50
# 2.0
🔢 More Operators
print(a % b) # Modulus (remainder)
print(a ** b) # Power
print(a // b) # Floor division
🧪 Example Program
a = int(input("Enter first number: "))
b = int(input("Enter second number: "))
print("Addition:", a + b)
print("Subtraction:", a - b)
print("Multiplication:", a * b)
print("Division:", a / b)
📌 Comparison Operators
a = 10
b = 5
print(a > b) # True
print(a < b) # False
print(a == b) # False
📌 Logical Operators
x = True
y = False
print(x and y) # False
print(x or y) # True
print(not x) # False
🎯 Mini Practice
num = int(input("Enter number: "))
print(num * 2)
print(num ** 2)
📌 Summary
✔ Arithmetic operators nerchukunnam
✔ Comparison & logical operators chusam
✔ Real-time example run chesam
Comments
Post a Comment