tgoop.com/python_bds/893
Create:
Last Update:
Last Update:
Python Basics
🔹 Variables = Store data for use in a program
x = 1🔹 Data Types = Classification of data (Boolean, String, Number)
print(x) # Output: 1
number = 10
if number > 0:
print("The number is true") # Output: true
🔹 Operators = Symbols for performing operations (+, -, *, /, %, etc.)
print(1 + 2) # Output: 3🔹 Control Statements = Manage program execution flow
print(2 - 1) # Output: 1
✔ Conditional Statements → "if-then" logic
score = 85✔ Loop Statements → Repeat actions (for, while loops)
if score >= 90:
print("Excellent")
elif score >= 75:
print("Good job")
else:
print("Keep trying")
count = 1🔹 Functions = Reusable blocks of code
while count <= 5:
print(count)
count += 1
def my_function():
print("Hello from a function")
my_function() # Output: Hello from a function
BY Python Learning
Share with your friend now:
tgoop.com/python_bds/893