Python For Beginners
Python For Beginners
CONCEPTS
A Beginner's Guide to
Python Programming
By Nithish
1. Variables and Data Types
Variables store data values.
-int(integer)
-float(decimal)
-str(string)
-bool(boolean)
Code Example
x = 5# int
y = 3.14 # float
name = "Nithish" # str
is_valid = True # bool
2. Control Structures
if-else Statements:
Conditional statements allow decision-
making.
If a condition is true, perform an action.
Code Example
if x > y:
print("x is greater than y")
else:
print("x is less than or equal
to y")
Loops
Use loops to repeat actions.
Types:
for loop
while loop
Code Example
for i in range(5):
print(i)
while x > 0:
print(x)
x -= 1
3. Functions
Code Example
def greet(name):
return f"Hello, {name}!"
print(greet("Nithish"))
4. Lists and Tuples
Lists are mutable
Tuples are immutable.
Use lists to store multiple items.
Code Example
Code Example
Code Example
Code Example