CS Project

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 53

BIO-DATA

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

2 WAP to find sum of series


S=1+x1/2!+x2 /3!+……+xn/(n+1)!

Write a program to print following


3 patterns depending on users choice:-
1)*
**
Nnm
aa ***
****
*****
2)12345
1234
123
12
1
A computerized ticket counter of an
underground metro rail station charges
for each ride at the following rates:

AGE(in years) AMOUNT


per head
50
18 or above
ruppees
5 or above but below
20
18
ruppees
Accompanying kids
NIL
below 5

Write a program which takes the


number of people of various age
groups as inpu and prints a ticket.At
the end of the journey,the program
states the number of passengers of
s
Different age groups who travelled and
total amount received as collection of
fares.
Write a program that which will read a
list of integers,updates all those
5. elements which have 5 as the last digit
with 1 and rest by 0 and print the
updated list.
Write a program which will read a
6. tuple of integers and prints the
maximum and minimum value stored
in tuple.
Write a program in python to print to
shift the negative numbers to right and
the positive numbers to left so that the
7. resultant list will be as follows:
Original list [-2,1,-3,-15,16,-17,5,-3,-6]
Output should be [1,16,5,-6,-3,-17,-
15,-3,-2]

Write a program in python to print the


fequency of all number in all a given
without duplication (i.e the frequency
of each element should be displayed
once only.)
D Eg:[2,3,5,1,2,7,3,6,8,9]
Output:
NoFrequency
1 1
2 2
3 1
4 1
5 1
6 1
7 1
8 1
9 1
Write a program that takes a sentence
9.
from user and prints all the words
which begins and ends with vowel.
Write a menu driven program which
will read will read a paragraph from a
user and perform the operations as per
the choice entered by user.
1-Search occurrences of a word if found
10.
otherwise print an appropriate
message.
2-Search occurrences of a letter(to
search a letter/digit in paragraph input
by user and print count of occurrences)
3-Quit
Write a program that takes a sentence
11.
from user and prints all the palindrome
words from the given sentence.
Write a program to create a menu
driven program to manage details of
applicants in a list details
include(AppID,AName,Qualification)the
available choices are:

12. 1-Add Applicant


2-Search applicant on the basis of
AppID
3-Modify applicant
4-Quit
Write a program to accept a paragraph
and create a frequency table of words
present in the given paragraph using a
dictionary.
13.
Input “This is a super idea and this idea
will change the idea of learning”
S={“This”:2, “is”:1, “a”:1, “super”:1,
“idea”:3, “will”:1, “change”:1, “the”:1,
“of”:1, “learning”:1}

14. Write a program to create a dictionary


with the roll number,name and marks
of ii students in a class and display
the names of students who have
marks above 75.
For the class representative post, 3
students are the candidates. Your
teacher has code named as ‘a’,
‘b’and ‘c’. Each student of the clas
has to vote to select the class
representative from them. The
voting data is available in the form of
following dictionary, which stores
15. which roll number voted for whom.
votes={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’}
Write a program to calculate total
votes for each of the candidates and
declare the winner.
Write a program to input your
friends’ names and their phone
number and store them in the
dictionary as the key-value pair.
Perform the following operations on
the dictionary:
16.
(a)Display the name and phone
number of all your friends.
(b)Add a new key-value pair in this
dictionary and display the modified
(c)Delete a particular friend from the
dictionary.
(d)Modify the phone number of an
existing friend.
(e)Check if a friend is present in the
dictionary or not.
(f)Display the dictionary in sorted
order of names.
HARDWARE AND SOFTWARE DETAILS

1)HARDWARE DETAILS—

Moniter

Keyboard

Mouse

2)SOFTWARE DETAILS—

IDLE python 3.8 64bit

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

You might also like