CS Project
CS Project
CS Project
NAME:-Ipshita Srivastava
CLASS:-XI-A
ROLL NUMBER:-07
SUBJECT:-Computer Science
SUBJECT TEACHER:-Mr.Gautam
Menghnani
CERTIFICATE
This is to certify that I, Ipshita Srivastava of
class XI-A has successfully complted the
project work ‘REPORT FILE PROGRAMS’ of
computer science for class XI practical
examination of CBSE in the year 2023-24.
It is further certified that this project is the
individual work of the candidate.
DATE:
TEACHER’S SIGNATURE:
INDEX
SR.NO PROGRAMS
Write a program to perform
Mathematical calculations like addition
subtraction,division and mutltiplication
between two integers.The program
should continue running until user gives
1 the choice to quit.The menu displayed is-
1-Addition
2-Sutraction
3-Division
4-Multiplication
5-Ouit
1)HARDWARE DETAILS—
Moniter
Keyboard
Mouse
2)SOFTWARE DETAILS—
New MS word
1)SOURCE CODE:
while True:
x=int(input("enter a number"))
y=int(input("enter a number"))
print('''1 for addition\n2 for subtraction\n3 for
division\n4 for multiplication''')
choice=int(input("enter choice"))
if(choice==1):
print("sum is",(x+y))
elif(choice==2):
print("difference is",(x-y))
elif(choice==3):
print("quotient is",(x/y))
elif(choice==4):
print("product is",(x*y))
else:
print(“invalid choice”)
OUTPUT:
enter a number8
enter a number4
1 for addition
2 for subtraction
3 for division
4 for multiplication
enter choice1
sum is 12
enter a number8
enter a number4
1 for addition
2 for subtraction
3 for division
4 for multiplication
enter choice2
difference is 4
enter a number8
enter a number4
1 for addition
2 for subtraction
3 for division
4 for multiplication
enter choice3
quotient is 2.0
enter a number8
enter a number4
1 for addition
2 for subtraction
3 for division
4 for multiplication
enter choice4
product is 32
enter a number8
enter a number4
1 for addition
2 for subtraction
3 for division
4 for multiplication
enter choice5
invalid choice
>>>
2)SOURCE CODE:
x=int(input(“enter the number”))
y=int(input(“enter the number of terms”))
sum=1
fact=1
for i in range(1,y+1):
fact=fact*(i+1)
sum=sum+(x**i)/fact
print(“sum of series is”,sum)
OUTPUT:
enter the number 7
enter the number of terms 12
sum of series 154.511965753510
>>>
3)SOURCE CODE:
print(“’1 for *
2 for numbers”’)
choice=int(input(“enter the choice”))
if(choice==1):
for j in range(1,6):
for i in range(1,j+1):
print(“*”,end=’’)
print()
elif(choice==2):
for j in range(6,1,-1):
for i in range(1,j):
print(i,end=’’)
print()
else:
quit
OUTPUT:
1 for *
2 for numbers
enter the choice 1
*
**
***
****
*****
>>>
1 for *
2 for numbers
enter the choice 2
12345
1234
123
12
1
>>>
1 for *
2 for numbers
enter the choice 3
>>>
4)SOURCE CODE:
count1=count2=count3=0
f=0
n=int(input(“enter number of passengers”))
for i in range(1,n+1):
age=int(input(“enter age”))
if(age<5):
a=0
count1=count1+1
f=f+1
elif(age>=5 and age<18):
a=20
count2=count2+1`
f=f+a
print(“number of passengers below 5
are”,count1)
print(“number of passengers between 5 and 18
are”,count2)
print(“number of passengers above 1
are”,count3)
print(“total fare is”,t)
OUTPUT:
enter number of passengers 6
enter age 4
enter age 2
enter age 16
enter age 44
enter age 23
enter age 19
number of passengers below 5 are 2
number of passengers between 5 and 18 are 1
number of passengers above 18 are 3
total fare is 170
>>>
5)SOURCE CODE:
X=eval(input(“enter the list of integers”))
X1=[]
for i in range(0,len(X)):
if(X[i]%10==5):
X1.append(1)
else:
X1.append(0)
Print(X1)
OUTPUT:
enter the list of intergers
[45,23,76,8,14,100,33,65]
[1,0,0,0,0,0,0,1]
>>>
6)SOURCE CODE:
t=eval(input("enter tuple of integers"))
max=0
min=99999999999
for i in range(len(t)):
if(t[i]>max):
max=t[i]
if(t[i]<min):
min=t[i]
print("maximum value is",max)
print("minimum value is",min)
OUTPUT:
enter tuple of integers(5,6,7,8,9,4,12,2)
maximum value is 12
minimum value is 2
>>>
7)SOURCE CODE:
X=eval(input(“enter the list of numbers”))
X1=[]
positive=[]
negative=[]
for i in range(0,len(X)):
if(X[i]>0):
positive.append(X[i])
elif(X[i]<0):
negative.append(X[i])
X1.extend(positive)
X1.extend(negative)
print(X1)
OUTPUT:
enter the list of numbers [-2,1,-3,-15,16,-17,5,-3,-
6]
[1,16,5,-2,-3,-15,-17,-3,-6]
>>>
8)SOURCE CODE:
X=eval(input(“enter the list of numbers”))
y=1
X.sort()
for i in range(0,len(X)-1):
if(X[i]==X[i+1]):
y=y+1
else:
print(X[i],“-->”,y)
y=1
print(X[-1],“-->”,y)
OUTPUT:
enter list of numbers [2,3,5,1,2,7,3,6,8,9]
1 --> 1
2 --> 2
3 --> 2
4 --> 1
5 --> 1
6 --> 1
7 --> 1
8 --> 1
9 --> 1
>>>
9)SOURCE CODE:
x=input(“enter the sentence”)
k=x.split()
for i in k:
if(i[0] in ‘AEIOUaeiou’ and i[-1]in
‘AEIOUaeiou’):
print(i)
OUTPUT:
enter the sentence I live in indira nagar
I
indira
>>>
10)SOURCE CODE:
while True:
print('''1 for searching for occurrence of words
2 for searching for occurrences of letters''')
choice=int(input("enter the choice"))
if(choice==1):
s=input("enter paragraph")
k=s.split()
n=0
x=input("enter word to be searched")
for i in k:
if(i==x):
n=n+1
if(n==0):
print("word found",n,"times")
else:
print("word not found")
elif(choice==2):
s=input("enter paragraph")
k=s.split()
n=0
x=input("enter letter to be searched")
for i in range(0,len(s)):
if(s[i]in x):
n=n+1
if(n==0):
print("letter found",n,"times")
else:
print ("letter not found")
else:
break
OUTPUT:
1 for searching for occurrence of words
2 for searching for occurrences of letters
enter the choice 1
enter paragraph music is a therapy
enter word to be searched therapy
word found 1 time
1 for searching for occurrence of words
2 for searching for occurrences of letters
enter the choice 1
enter paragraph music is a therapy
enter word to be searched hello
word not found
1 for searching occurrence of words
2 for searching occurrences of letters
enter the choice 2
enter paragraph music is a therapy
enter letter to be searched a
letter found 2 times
1 for searching occurrence of words
2 for searching occurrences of letters
enter the choice 2
enter paragraph music is a therapy
enter letter to be searched k
letter not found
1 for searching occurrence of words
2 for searching occurrences of letters
enter the choice 3
>>>
11)SOURCE CODE:
S=input(“enter a sentence”)
rev=””
for i in range(len(S)-1,-1,-1):
rev=rev+S[i]
if(rev==S):
print(S,“is palindrome”)
else:
print(S,“is not palindrome”)
OUTPUT:
enter a sentence dad
dad is palindrome
>>>
enter a sentence hello my name is
hello my name is is not pallimdrome
>>>
12)SOURCE CODE:
while True:
print(“‘1 for adding applicants
2 for searching on the basis of AppID
3 for modifying applicant
4 for quitting”’)
choice=int(input(“enter your choice”))
if(choice==1):
s=[]
n=int(input(“enter the number of
applicants”))
for i in range(0,n):
appId=int(input(“enter id”))
name=input(“enter name”)
qual=input(“enter qualification”)
a=[appId,name,qual]
s.append(a)
print(s)
elif(choice==2):
flag=0
x=int(input(“enter appId to be searched”))
for i in range(0,len(s)):
if(s[i][0]==x):
print(“detail found”,s[i])
flag=1
break
if(s[i][0]!=x):
print(“detail not found”)
elif(choice==3):
x=int(input(“enter appId to be modified”))
flag=0
for i in range(0,len(s)):
if(s[i][0]==x):
y=int(input(“enter new appId”))
s[i][0]=y
flag=1
print(“modified detail”,s[i])
break
if(flag==0):
print(“detail not found”)
else:
break
OUTPUT:
1 for adding applicants
2 for searching on the basis of app
3 for modifying applicant
4 for quitting
enter your choice 1
enter number of applicants 2
enter id 544
enter name rekha
enter qualification b.com
enter id 545
enter name rohah
enter qualification b.tech
[[544, ‘rekha’, ‘b.com’], [545, ‘rohan’, ‘b.tech’]]
1 for adding applicants
2 for searching on the basis of aapId
3 for modifying applicant
4 for quitting
enter your choice 2
enter addId to be searched 545
detail found [545, ‘rohan’, ‘b.tech’]
1 for adding applicants
2 for searching on the basis appId
3 for modifying applicant
4 for quitting
enter your choice 3
enter appId to be modified 544
enter new appId 546
modified detail [546, ‘rekha’, ‘b.com’]
1 for adding applicant
2 for searching on the basis appId
3 for modifying applicant
4 for quitting
enter your choice 4
>>>
13)SOURCE CODE:
d=input(“enter a paragraph”)
s={}
k=d.split()
for i in k:
if(i not in s):
s[i]=1
else:
s[i]=d[i]+1
print(s)
OUTPUT:
enter a paragraph this is a super idea and this
idea will change the idea of learning
{‘this’:2, ‘is’:1, ‘a’:1, ‘super’:1, ‘idea’:3, ‘and’:1,
‘will’:1, ‘change’:1, ‘the’:1, ‘of’:1, ‘learning’:1}
>>>
14)SOURCE CODE:
n=int(input("enter number of students"))
x={}
y={}
for i in range(0,n):
roll=int(input("enter roll number"))
name=input("enter name")
marks=int(input("enter marks"))
x[roll]=name,marks
print(x)
for i in x:
if(x[i][1]>75):
print(x[i][0])
OUTPUT:
enter number of students
2
enter roll number
13
enter name
arnav
enter marks
67
enter roll number
18
enter name
prachi
enter marks
98
{13: (‘arnav’,67), 18: (‘prachi’,98)}
prachi
>>>
15)SOURCE CODE:
vote={1:'a',2:'a',3:'c',4:'a',5:'c',6:'b',7:'b',8:'b',9:'
a',10:'c',11:'a',12:'b',13:'b',14:'c',15:'b'}
x={'a':0,'b':0,'c':0}
for vote in vote.values():
if(vote in x):
x[vote]=x[vote]+1
winner=max(x,key=x.get)
print("vote count is:")
for candidate,count in x.items():
print(f"{candidate}:{count}votes")
print(f"the winner is
candidate'{winner}'with{x[winner]}votes")
OUTPUT:
Vote count is:
a:5 votes
b:7votes
c:4 votes
the winner is candidate ‘b’ with 7 votes
>>>
16)SOURCE CODE:
s={}
n=int(input("enter number of friends"))
for i in range(0,n):
name=input("enter name")
phone=int(input("enter phone number"))
s[name]=phone
while True:
print('''1 for display all
2 for adding a new friend
3 for deleting a friend
4 for modifying phone number
5 for checking whether friend is present or not
6 for display in name order''')
choice=int(input("enter your choice"))
if(choice==1):
print(s)
elif(choice==2):
s1=[]
name1=input("enter new name")
phone1=int(input("enter phone number"))
s[name1]=phone1
print(s)
elif(choice==3):
x=input("enter name to be deleted")
if x not in s:
print("name not found")
else:
del s[x]
print(s)
elif(choice==4):
x=(input("enter name whose phone number
is to be modified"))
if x in s:
y=int(input("enter new phone number"))
s[x]=y
print(s)
elif(choice==5):
s1=[]
a=''
x=input("enter name to be checked")
if x in s:
print("name found",(x,s[x]))
else:
print("name not found")
elif(choice==6):
s1=sorted(s.item())
print(s1)
else:
break
OUTPUT:
enter number of friends2
enter name ram
enter phone number 2868
enter nameashok
enter phone number 6828
1 for display all
2 for adding a new friend
3 for deleting a friend
4 for modifying phone number
5 for checking whether friend is present or not
6 for display in name order
enter your choice 1
{'ram': 2868, 'ashok': 6828}
1 for display all
2 for adding a new friend
3 for deleting a friend
4 for modifying phone number
5 for checking whether friend is present or not
6 for display in name order
enter your choice 2
enter new name rakesh
enter phone number 4567
{'ram': 2868, 'ashok': 6828, 'rakesh': 4567}
1 for display all
2 for adding a new friend
3 for deleting a friend
4 for modifying phone number
5 for checking whether friend is present or not
6 for display in name order
enter your choice 3
enter name to be deleted ashok
{'ram': 2868, 'rakesh': 4567}
1 for display all
2 for adding a new friend
3 for deleting a friend
4 for modifying phone number
5 for checking whether friend is present or not
6 for display in name order
enter your choice4
enter name whose phone number is to be
modified rakesh
enter new phone number 3868
{'ram': 2868, 'rakesh': 3868}
1 for display all
2 for adding a new friend
3 for deleting a friend
4 for modifying phone number
5 for checking whether friend is present or not
6 for display in name order
enter your choice 5
enter name to be checked ram
name found ('ram', 2868)
1 for display all
2 for adding a new friend
3 for deleting a friend
4 for modifying phone number
5 for checking whether friend is present or not
6 for display in name order
enter your choice 6
[(‘
w
w
ww
w
w
w