📝 Python Assignment – 01
Topics: Variables, Data Types & Operators
Dear Students,
This assignment will help you practice the basics of Python. Please attempt all questions.
Q1: Variables & Data Types
1. Create the following variables:
○ name → your full name
○ age → your age
○ is_student → a boolean value (True/False)
2. Print all variables in one line.
3. Print the data type of each variable using type().
Q2: Arithmetic Operators
Let x = 20 and y = 6.
Perform and print the results of:
● Addition
● Subtraction
● Multiplication
● Division
● Floor Division
● Modulus
● Exponent
Q3: Assignment Operators
Let num = 10.
1. Add 5 to num using the += operator.
2. Multiply num by 2 using the *= operator.
3. Subtract 4 from num using the -= operator.
4. Print the final value of num.
Q4: Comparison Operators
Take a = 15 and b = 12.
Check and print the results of the following comparisons:
● a > b
● a < b
● a == b
● a != b
● a >= b
● a <= b
Q5: Logical Operators
Let p = True and q = False.
Check and print the result of:
● p and q
● p or q
● not p
● not q
Q6: Real-Life Example
The price of one notebook is 80 rupees.
● If you buy 7 notebooks, calculate the total price.
● If you have 600 rupees, check (using comparison operator) whether your money is
enough to buy them or not.
● Print the result in a clear message.
Q7: Bonus (Optional)
Take two numbers as input from the user.
● Print their sum.
● Print whether the first number is greater than the second number or not.
📌 Instructions
● Use comments (#) to explain each step.
● Keep your code neat and readable.
● Submit the vscode .py or google colab file before the deadline.