0% found this document useful (0 votes)
17 views2 pages

Class XII Python Questions With Answers Federal Board

The document contains practical Python programming questions and their corresponding answers for Class XII Federal Board students. It covers various topics including basic arithmetic operations, area calculations, interest calculations, conversions, and more. Each question includes a simple program that demonstrates the use of variables, operators, and input/output handling.

Uploaded by

bzeshankhan8
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views2 pages

Class XII Python Questions With Answers Federal Board

The document contains practical Python programming questions and their corresponding answers for Class XII Federal Board students. It covers various topics including basic arithmetic operations, area calculations, interest calculations, conversions, and more. Each question includes a simple program that demonstrates the use of variables, operators, and input/output handling.

Uploaded by

bzeshankhan8
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Class XII Federal Board – Python Practical Questions with Answers

SLO CS-11-C-01: Write and execute simple programs using variables, operators, and input/output
handling.

Question: 1. Write a Python program that takes two numbers from the user and displays their sum.
Answer:
a = int(input("Enter first number: ")) b = int(input("Enter second number: ")) sum = a + b print("Sum
=", sum)

Question: 2. Write a Python program to calculate the area of a rectangle.


Answer:
length = int(input("Enter length: ")) width = int(input("Enter width: ")) area = length * width print("Area
=", area)

Question: 3. Write a Python program to calculate simple interest.


Answer:
p = int(input("Enter principal: ")) r = int(input("Enter rate: ")) t = int(input("Enter time: ")) si = (p * r * t)
/ 100 print("Simple Interest =", si)

Question: 4. Write a Python program to find the average of three numbers.


Answer:
a = int(input("Enter first number: ")) b = int(input("Enter second number: ")) c = int(input("Enter third
number: ")) avg = (a + b + c) / 3 print("Average =", avg)

Question: 5. Write a Python program to convert Celsius into Fahrenheit.


Answer:
c = int(input("Enter temperature in Celsius: ")) f = (c * 9 / 5) + 32 print("Fahrenheit =", f)

Question: 6. Write a Python program to calculate total salary after adding bonus.
Answer:
salary = int(input("Enter salary: ")) bonus = int(input("Enter bonus: ")) total = salary + bonus
print("Total Salary =", total)

Question: 7. Write a Python program to find the remainder of two numbers.


Answer:
a = int(input("Enter dividend: ")) b = int(input("Enter divisor: ")) rem = a % b print("Remainder =",
rem)

Question: 8. Write a Python program to calculate total marks and percentage.


Answer:
m1 = int(input("Enter marks of subject 1: ")) m2 = int(input("Enter marks of subject 2: ")) m3 =
int(input("Enter marks of subject 3: ")) total = m1 + m2 + m3 percentage = (total / 300) * 100
print("Total Marks =", total) print("Percentage =", percentage)

Question: 9. Write a Python program to swap two numbers.


Answer:
a = int(input("Enter first number: ")) b = int(input("Enter second number: ")) a, b = b, a print("a =", a)
print("b =", b)

Question: 10. Write a Python program to calculate electricity bill.


Answer:
units = int(input("Enter units consumed: ")) rate = int(input("Enter rate per unit: ")) bill = units * rate
print("Electricity Bill =", bill)

Question: 11. Write a Python program to find the square of a number.


Answer:
num = int(input("Enter number: ")) square = num * num print("Square =", square)

Question: 12. Write a Python program to convert rupees into dollars.


Answer:
rupees = int(input("Enter amount in rupees: ")) rate = 280 dollars = rupees / rate print("Amount in
dollars =", dollars)

Question: 13. Write a Python program to calculate speed.


Answer:
distance = int(input("Enter distance: ")) time = int(input("Enter time: ")) speed = distance / time
print("Speed =", speed)

Question: 14. Write a Python program to calculate discounted price.


Answer:
price = int(input("Enter original price: ")) discount = int(input("Enter discount percentage: "))
final_price = price - (price * discount / 100) print("Final Price =", final_price)

Question: 15. Write a Python program to convert minutes into hours.


Answer:
minutes = int(input("Enter minutes: ")) hours = minutes / 60 print("Hours =", hours)

You might also like