0% found this document useful (0 votes)
45 views

CS Practical File - Term I

This document contains the practical file submitted by Tanay Maheshwari of class XI 'A' at Choithram School, Manik Bagh, Indore. It includes 15 programming problems solved using Python with the goal of learning basic programming concepts like loops, conditional statements, functions etc. Each problem is numbered and includes the code, sample input/output and a brief description.

Uploaded by

Tanay Maheshwari
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)
45 views

CS Practical File - Term I

This document contains the practical file submitted by Tanay Maheshwari of class XI 'A' at Choithram School, Manik Bagh, Indore. It includes 15 programming problems solved using Python with the goal of learning basic programming concepts like loops, conditional statements, functions etc. Each problem is numbered and includes the code, sample input/output and a brief description.

Uploaded by

Tanay Maheshwari
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
You are on page 1/ 6

CHOITHRAM SCHOOL, MANIK BAGH,

INDORE

CBSE CLASS XI 2021-22


Computer Science Practical File (Code :417)

Submitted to: Submitted by:


Ms. Pardeep Kaur Arora Tanay Maheshwari
XI ‘A’
CHOITHRAM SCHOOL MANIK BAGH, INDORE
PRACTICAL FILE (COMPUTER SCIENCE Code : 083)

S.No. Program Output

1. WAP to check whether a character is a capital,


small letter or a number.

choice=input("Enter one Character")


if(choice>="A" and choice<="Z"):
print("Capital Letter has been entered")
elif(choice>="a" and choice<="z"):
print("Small Letter has been entered")
elif(choice>="0" and choice<="9"):
print("A digit has been entered")
else:
print("Special Symbol")

2. WAP to convert cm to meter, gram to kilogram, litre


to millilitre, centigrade to Fahrenheit using a menu
driven user choice

n=int(input("enter your conversion choice: 1.cm to


meter 2.gram to kilogram 3. litre to millilitre 4.
centigrade to Fahrenheit "))
if n==1:
m=int(input("Enter your value in cm "))
meter = m / 100.0
print("Length in meter = " , meter , "m")
elif n==2:
m=int(input("Enter your value in g "))
kilogram = m / 1000.0
print("Mass in kg = " , kilogram , "kg")
elif n==3:
m=int(input("Enter your value in l "))
millilitre = m * 1000
print("Volume in ml = " , millilitre , "ml")
elif n==4:
m=int(input("Enter your value in c° "))
fahrenheit = (m * 1.8)+32
print("Temperature in c° = " , fahrenheit , "c°")
else:
print("invalid value")

3. WAP to make calculator by character selection of


operators i.e +,×,÷,-

val1 = float(input("Enter value 1: "))


val2 = float(input("Enter value 2: "))
op = input("Enter operator (+,-,*,/): ")
if op == "+":
result = val1 + val2
print("The result is ",result)
elif op == "-":
if val1 > val2:
result = val1 - val2
print("The result is ",result)
else:
result = val2 - val1
print("The result is ",result)
elif op == "*":
result = val1 * val2
print("The result is ",result)
elif op == "/":
if val2 == 0:
print("Error! Division by zero is not allowed.
Program terminated")
else:
result = val1/val2
print("The result is ",result)
else:
print("Wrong input, program terminated")

4. WAP to print the sum of cubes of numbers from 1


to n (where n is user entered).

n = int(input('Enter upper limit'))


s=0
for i in range (1,n+1):
s=s+(i*i*i)
print ('Sum of cubes is =',s)

5. WAP to print even numbers from 1 to n using While


loop (where n is user entered).

i=0
n=int(input("Enter the ending limit "))
s=0
while i<n-1:
i=i+2
s=s+i
print("the sum of even numbers",n,"=",s)

6. WAP to print numbers in reverse order from (n) to 1


(where n is user entered)

n=int(input("Enter the ending value of the series "))


while n>=1:
print(n)
n=n-1
7. WAP to print the 11 + 22 + 33 + 44 + 55 .

s=0
i=1
while i<=5 :
answer=1
j=1
while j<=i :
answer=answer*i
j=j+1
s=s+answer
i=i+1
print("the sum of the series is:",s)

8. WAP to print the sum of series 1/1 + 1/2 + 1/3 + 1/4


……. 1/n.

n=int(input("Enter the number"))


s=0
for i in range(1,n+1):
s=s+1/i
print(s)

9. WAP to print the pattern: A


AB
ABC
ABCD
ABCDE
i=65
while i<70:
j=65
while j<=i:
print(chr(j),end=" ")
j=j+1
print("\n")
i=i+1

10. WAP to print sum of even numbers and odd


numbers individually from 1 to 50 using the While
loop.

se=0
so=0
i=0
while i<=50:
if i%2==0:
se=se+ i
else :
so=so+ i
i=i+1
print ('Sum of odd numbers is :',so)
print ('Sum of even numbers is :',se)

11. WAP to add two numbers and print sum till the
user enters ‘n’ as response using break statement.

res='yes'
while res=='yes':
a=int(input('Enter first number'))
b=int(input('Enter second number'))
print(a+b)
res=input('Do you want to continue')
if res=='no':
break
else:
continue

12. WAP to display the first 10 Mersenne numbers


using a while loop.

print("First 10 mersenne numbers: ")


i=1
while i<=10:
mersen=2**i-1
print(mersen)
i=i+1

13. WAP to check whether the number entered is an


ARMSTRONG number or not.

n= int(input("Enter a 3 digit number: "))


s=0
temp=n
while temp>0:
digit=temp%10
s=s+(digit**3)
temp=temp//10
if(n==s):
print(n, "is an armstrong number")
else:
print(n, "is not an armstrong number")

14. WAP to print the factorial of a number entered by


the user using a for loop.

n= int(input("Enter a number: "))


m=1
for i in range (1,n+1):
m=m*i
print (m)

15. WAP to check whether the number entered is a


prime number or not.

count=0
n=int(input("enter number to check"))
if n==1:
print("neither prime nor composite")
if n>1:
for i in range(1,n+1) :
if n%i==0 :
count=count+1
if count==2:
print ("Prime number")
else:
print ("Not a prime number")

- THANK YOU -

You might also like