Professional Documents
Culture Documents
Module 2 of Python Basics by A K Singh
Module 2 of Python Basics by A K Singh
1. Subtopics:
a. Conditional Statements (if, else, elif)
b. Loops (for, while)
c. Functions (Defining and Calling)
2. Quizzes:
a. Coding challenges to write programs using if statements
for decision-making.
b. Exercises to create functions for repetitive tasks.
Python Code :
age = 18
if age >= 18:
print("You are eligible to vote.")
Python Code :
grade = 85
if grade >= 90:
print("Excellent! You earned an A.")
elif grade >= 80:
print("Great job! You earned a B.")
else:
print("Keep practicing! You earned a C or
below.")
Python Code :
count = 1
while count <= 5:
print(f"Current count: {count}")
count += 1 # Increment the counter
Python Code :
def greet(name):
"""This function greets a person by name."""
print(f"Hello, {name}!")
greet("Alice") # Calling the function with an
argument