STD Xi Comp Sci Practical Report File
STD Xi Comp Sci Practical Report File
STD Xi Comp Sci Practical Report File
2023-24
NAME:
ROLL NO:
CLASS: XI
STREAM:
NERUL, NAVI MUMBAI
CERTIFICATE
Roll No. :
__________________
Internal Examiner
Date:
__________________ ___________________
SCHOOL SEAL PRINCIPAL
Date:
PYTHON PROGRAMS
Code:
print(msg)
SAMPLE OUTPUT:
Code:
SAMPLE OUTPUT:
3. Write Python program to print the area of circle when radius
of the circle is given by user.
Code:
PI=3.14
area = PI*radius**2
SAMPLE OUTPUT:
Code:
avg=(sub1+sub2+sub3+sub4+sub4)/5
SAMPLE OUTPUT:
5. Write a short program that asks for your height in centimetres
and then converts your height to feet and inches. (1 foot = 12
inches, 1 inch = 2.54 cm).
Code:
SAMPLE OUTPUT:
6. Write Python program to compute simple interest and
compound interest.
Code:
#simple interest
P = float(input("enter amount"))
R = float(input("enter rate"))
T = float(input("enter time"))
SI = (P * R * T) / 100
print("simple interest is", SI)
#Compound Interest
principle=float(input("Enter principle amount:"))
time=int(input("Enter time duration:"))
rate=float(input("Enter rate of interest:"))
SAMPLE OUTPUT:
7. Write Python program to calculate the Area of a Triangle
(given base and height)
Code:
area = (b * h) / 2
SAMPLE OUTPUT:
Code:
SAMPLE OUTPUT:
9. Write Python program to convert Celsius into Fahrenheit.
Code:
SAMPLE OUTPUT:
Code:
SAMPLE OUTPUT:
11. WAP to find the factorial of a number
Code:
n=int(input("Enter number:"))
fact=1
while(n>0):
fact=fact*n
n=n-1
print("Factorial of the number is: ")
print(fact)
SAMPLE OUTPUT:
12. WAP to Input three numbers and display the largest number.
Code:
SAMPLE OUTPUT:
13. Write Python program to Display the terms of a Fibonacci
series.
Code:
First_Value = 0
Second_Value = 1
Next = Num
else:
First_Value = Second_Value
Second_Value = Next
print(Next)
SAMPLE OUTPUT:
14. WAP to print the following series:
(i) 1 4 7 10. . . . . . . 40
(ii) 1 -4 7 -10 . . . . . . . - 40
Code:
print("First Series:")
print("\nSecond Series:")
x=1
x *= -1
SAMPLE OUTPUT:
15. WAP to determine whether a number is a palindrome.
Code:
n=int(input("Enter number:"))
temp=n
rev=0
while(n>0):
dig=n%10
rev=rev*10+dig
n=n//10
if(temp==rev):
else:
SAMPLE OUTPUT:
16. Write a Program to take in the marks of 5 subjects and
display the grade.
Code:
SAMPLE OUTPUT:
17. WAP to check the given year is leap year or not
Code:
SAMPLE OUTPUT:
18. WAP to Determine whether a number is a perfect number.
Code:
sum1 = 0
if(n % i == 0):
sum1 = sum1 + i
if (sum1 == n):
else:
SAMPLE OUTPUT:
19. WAP to determine whether a number is an armstrong number.
Code:
import math
print ("Enter the a number")
number = int(input())
#to calculate the number of digits in a number
number_of_digits = int(math.log10(number))+1
sum_arm = 0
temp = number
while temp != 0:
sum_arm = sum_arm + int(math.pow (temp%10,number_of_digits))
temp = temp//10
if sum_arm == number:
print ("Yes an Armstrong number")
else:
print ("No")
SAMPLE OUTPUT:
20. WAP to Input a number and check if the number is a prime or
composite number.
Code:
import math
number = int(input())
i=2
prime = True
#if the number is not divisible by any number less than the
#square root of the number
#then it is prime
if number%i == 0:
prime = False
break
i = i+1
if number < 2:
prime = False
if prime:
else:
SAMPLE OUTPUT:
21. Write a Menu-Driven Program to create a simple calculator
Code:
while True:
print("\nMENU")
print("5. Exit")
if choice == 1:
print( "\nADDITION\n")
sum = a + b
elif choice == 2:
print( "\nSUBTRACTION\n")
difference = a - b
print( "\nMULTIPLICATION\n")
product = a * b
elif choice == 4:
print( "\nDIVISION\n")
division = a / b
elif choice == 5:
break
else:
SAMPLE OUTPUT: