Python Masterclass – Day 1 Assignment
■ Topics Covered:
Variables, Data Types, Operators, Type Casting
1■■ Question 1: Variables
Create a Python program that stores your name, age, and favorite programming language in
variables, then prints them using a formatted print statement.
Example:
My name is Mahiman, I am 25 years old, and my favorite programming language is Python.
2■■ Question 2: Data Types and type() Function
Write a Python program that declares variables of different data types — integer, float, string, and
boolean. Print both their values and their data types using the type() function.
Example Output:
Value: 25, Type:
Value: 12.5, Type:
Value: Hello, Type:
Value: True, Type:
3■■ Question 3: Operators
Write a Python program that takes two numbers as input, performs arithmetic operations (addition,
subtraction, multiplication, division), and checks which number is greater using a comparison
operator.
Example Output:
Enter first number: 10
Enter second number: 5
Addition: 15
Subtraction: 5
Multiplication: 50
Division: 2.0
Is first number greater? True
4■■ Question 4: Type Casting
Write a Python program that demonstrates implicit and explicit type casting. Example: adding int +
float (implicit) and converting string input to int (explicit).
Example Output:
Implicit Conversion Example:
Result = 10 + 5.5 = 15.5
Explicit Conversion Example:
Enter number as string: '10'
After conversion: 10
Addition Result: 20
■ Challenge Question (Optional)
Create a script that takes a student's name, marks in 3 subjects, and attendance percentage.
Calculate the average marks and determine Pass/Fail status based on the following: If average ≥
50 and attendance ≥ 75 → Pass, else → Fail.
Example Output:
Enter your name: Mahiman
Enter marks in Python: 80
Enter marks in SQL: 70
Enter marks in Power BI: 65
Enter attendance percentage: 85
Average Marks: 71.66
Result: Pass ■
■ Submission Guidelines:
• File Name: Day1_Assignment_.py
• Add comments explaining your code.
• Keep your code clean and properly indented.
• Submit before the next session.
■ Keep Practicing! Each line of Python you write takes you one step closer
to mastering Data Engineering.