Python Practical Worksheet
Grade 11 AI
Note: Each question in this worksheet includes a Sample Run, which demonstrates the
expected output for reference. Students should compare their program’s output with the
sample to verify correctness.
Q1. Write a Python program to:
• Take the user’s name and age as input.
• Print a greeting message in the format:
"Hello <name>, you are <age> years old."
SAMPLE RUN:
Enter your name: Riya
Enter your age: 17
Hello Riya, you are 17 years old.
Q2. Write a Python program to accept two numbers from the user and display:
• Sum
• Difference
• Product
• Quotient (up to 2 decimal places)
SAMPLE RUN:
Enter first number: 10
Enter second number: 4
Sum: 14.0
Difference: 6.0
Product: 40.0
Quotient: 2.5
Q3. Write a Python program to take a number as input and check whether it is:
• Positive
• Negative
• Zero
SAMPLE RUN:
Enter a number: -5
The number is Negative.
Q4. Write a Python program to print the following pattern using a for loop for n = 5:
**
***
****
*****
Q5. Write a Python program using a for loop to display the square of numbers from 1 to 10.
SAMPLE RUN:
The square of 1 is 1
The square of 2 is 4
The square of 3 is 9
The square of 4 is 16
The square of 5 is 25
The square of 6 is 36
The square of 7 is 49
The square of 8 is 64
The square of 9 is 81
The square of 10 is 100
Q6. Write a Python program to display all even numbers from 1 to 20 using a for loop.
SAMPLE RUN:
2 4 6 8 10 12 14 16 18 20