Assignment


1️⃣ Setting Up Python & Development Environment (4 Assignments)

Assignment 1: Install Python and Verify Installation

🔹 Task: Install Python and check if it’s working. 🔹 Example Snippet:

python --version

✔️ Expected Output:

Python 3.x.x

Assignment 2: Running a Python Script

🔹 Task: Write and run a simple Python script that prints "Hello, Python!". 🔹 Example Snippet:

print("Hello, Python!")

Assignment 3: Using Python in Interactive Mode

🔹 Task: Open Python in the terminal and perform simple arithmetic calculations. 🔹 Example Snippet:

>>> 5 + 3
8
>>> 10 / 2
5.0

Assignment 4: Installing and Using VS Code (or PyCharm)

🔹 Task: Install VS Code (or PyCharm) and run a simple Python script.


2️⃣ Basic Syntax, Data Types, and Variables (6 Assignments)

Assignment 5: Printing Messages and Comments

🔹 Task: Write a program that prints a message and includes a comment. 🔹 Example Snippet:


Assignment 6: Using Variables

🔹 Task: Define variables for name, age, and city, then print them. 🔹 Example Snippet:


Assignment 7: Understanding Data Types

🔹 Task: Print the data types of different variables. 🔹 Example Snippet:

✔️ Expected Output:


Assignment 8: Performing Arithmetic Operations

🔹 Task: Write a program to perform basic arithmetic operations. 🔹 Example Snippet:


Assignment 9: Taking User Input

🔹 Task: Ask the user for their name and age, then print a greeting. 🔹 Example Snippet:


Assignment 10: Type Conversion

🔹 Task: Convert a user-inputted string number into an integer and add 10. 🔹 Example Snippet:


3️⃣ Control Flow (if-else, loops) (6 Assignments)

Assignment 11: Using if-else Statements

🔹 Task: Write a program that checks if a number is positive, negative, or zero. 🔹 Example Snippet:


Assignment 12: Even or Odd Number Checker

🔹 Task: Check whether a number is even or odd. 🔹 Example Snippet:


Assignment 13: Using While Loop

🔹 Task: Print numbers from 1 to 5 using a while loop. 🔹 Example Snippet:


Assignment 14: Using For Loop with a Range

🔹 Task: Print numbers from 1 to 10 using a for loop. 🔹 Example Snippet:


Assignment 15: Printing Multiplication Table

🔹 Task: Take a number as input and print its multiplication table. 🔹 Example Snippet:


Assignment 16: Using Break and Continue in Loops

🔹 Task: Skip printing number 5 and stop when reaching 8. 🔹 Example Snippet:


4️⃣ Functions & Modular Programming (4 Assignments)

Assignment 17: Defining and Calling a Function

🔹 Task: Write a function that prints a greeting message. 🔹 Example Snippet:


Assignment 18: Function with Parameters

🔹 Task: Write a function that adds two numbers and returns the result. 🔹 Example Snippet:


Assignment 19: Using Default Arguments in Functions

🔹 Task: Create a function with a default argument. 🔹 Example Snippet:


Assignment 20: Importing Functions from Another File

🔹 Task: Create a file utils.py with a function and import it. 🔹 Example Snippet (utils.py):

🔹 Example Snippet (main.py):


Last updated