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

Assignmentm

program

Uploaded by

kumudnegi12
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)
6 views

Assignmentm

program

Uploaded by

kumudnegi12
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/ 27

Program1- Write a program to draw a pattern of your name in given

format by using for loop:-


1
12
123
1234

Programing:-

a=input('Enter your name')


b=len(a)
for i in range (1,b+1):
for j in range(0,i):
print(a[j],end=' ')
print()
Output:-

Enter your nameARPIT

A
A R
A RP
A RP I
A R P IT
Program2-Write a program to input three values as sides of a triangle.
Check it is a equilateral triangle, isosceles, scalene or right angled
triangle. Also find the area and perimeter of triangle formed.

Programing:-

a=float(input("Enter first side of a triangle in cm"))


b=float(input("Enter second side of a triangle in cm"))
c=float(input("Enter third side of a triangle in cm"))

if (a+b)>c or (b+c)>a or (a+c)>b:


if a==b==c:
print('It is a Equilateral triangle')
elif a==b or a==c or b==c:
print('It is a Isosceles triangle')
elif (a**2)+(b**2)==c**2 or (a**2)+(c**2)==b**2 or
(c**2)+(b**2)==a**2:
print('It is a Right angle triangle')
else:
print('It is a Scalene triangle')
else :
print('It is not a triangle')
P=a+b+c
s=(a+b+c)/2
A=(s*(s-a)*(s-b)*(s-c))**(1/2)
print("Area of the triangle sides",a,'cm,',b,'cm,',c,'cm,','is',A,'cmsquare')
print("Perimeter of the triangle sides",a,'cm,',b,'cm,',c,'cm,','is',P,'cm')
Output:-

Enter first side of a triangle in cm5.5


Enter second side of a triangle in cm5.5
Enter third side of a triangle in cm5.5
It is a Equilateral triangle
Area of the triangle sides 5.5 cm, 5.5 cm, 5.5 cm, is 13.09863423229 cm2
Perimeter of the triangle sides 5.5 cm, 5.5 cm, 5.5 cm, is 16.5 cm

Enter first side of a triangle in cm7.5


Enter second side of a triangle in cm7.25
Enter third side of a triangle in cm7.5
It is a Isosceles triangle
Area of the triangle sides 7.5 cm, 7.25 cm, 7.5 cm, is 23.80092710087 cm2
Perimeter of the triangle sides 7.5 cm, 7.25 cm, 7.5 cm, is 22.25 cm

Enter first side of a triangle in cm8.25


Enter second side of a triangle in cm8.5
Enter third side of a triangle in cm9
It is a Scalene triangle
Area of the triangle sides 8.25 cm, 8.5 cm, 9.0 cm, is 31.772718096416853
cm2
Perimeter of the triangle sides 8.25 cm, 8.5 cm, 9.0 cm, is 25.75 cm
Enter first side of a triangle in cm3
Enter second side of a triangle in cm4
Enter third side of a triangle in cm5
It is a Right angle triangle
Area of the triangle sides 3.0 cm, 4.0 cm, 5.0 cm, is 6.0 cm2
Perimeter of the triangle sides 3.0 cm, 4.0 cm, 5.0 cm, is 12.0 cm
Program3-Write a program to accept the values of height & radius of
a cone. Also find its CSA, TSA and volume.

Programing:-

a=float(input('Enter the height of the cone in m'))


b=float(input('Enter the radius of the cone in m'))
c=((b**2)+(a**2))**(1/2) #slant height
d=3.14*b*(b+c) #TSA
e=3.14*b*c #CSA
f=(1/3)*(3.14*(b**2)*a)
print('The Total Surface Area of Cone=',d,'m square')
print('The Curved Surface Area of Cone=',e,'m square')
print('The Volume of the cone=',f,'m cube')
Output:-

Enter the height of the cone in m5.5


Enter the radius of the cone in m7.5

The Total Surface Area of Cone= 395.65266092436815 m square


The Curved Surface Area of Cone= 219.0276609243682 m square
The Volume of the cone= 323.8125 m cube
Program5- Write to make a program a pattern by using while loop:
1
12
123
1234
12345

Programing:-

row=1
while row<=5:
spaces=5-row
while spaces>0:
print(" ",end="")
spaces-=1
column=1
while column<=row:
print(column,end="")
column+=1
print()
row+=1
Output:-

1
12
123
1234
12345
Program 6- Write a program to make a list of 10 elements by using user
input. Search an element by user’s choice by using linear search.

Programing:-

b=int(input("Enter the length of list"))


L=[]
for i in range(1,b+1):
L1=int(input("Enter Value in a list"))
L.append(L1)
print("The List is",L)
a=int(input("Enter the value which we have to search"))
if a in L:
print("The enter number ",a,"is in list.","Its index number=",L.index(a))
else:
print("The enter number ",a,"is not in list")
Output:-

Enter the length of list10


Enter Value in a list787
Enter Value in a list654
Enter Value in a list987
Enter Value in a list354
Enter Value in a list789
Enter Value in a list159
Enter Value in a list357
Enter Value in a list459
Enter Value in a list426
Enter Value in a list789

The List is [787, 654, 987, 354, 789, 159, 357, 459, 426, 789]
Enter the value which we have to search789
The enter number 789 is in list. Its index number= 4
Program7- Write a program to make a dictionary by user’s choice apply
pop(), key(), values() and popitem() functions on it.
After applying every function generate separate output for each.

Programing:-

D={}
x=int(input("Enter number of items in a dictionary"))
for i in range(1,x+1):
a=input("Enter value of key")
D[i]=a
print('Dictionary=',D)
b=D.keys()
c=D.values()
print("The output of keys()-",b)
print("The output of values()-",c)
y=int(input('Enter the key of that item which have to be deleted'))
r=D.pop(y)
s=D.popitem()
print("The output of pop()-",r)
print("The output of popitem()-",s)
Output:-

Enter number of items in a dictionary5


Enter value of keyAman
Enter value of keyYashvardhan
Enter value of keyAditya
Enter value of keySiddharth
Enter value of keyArpit

Dictionary= {1: 'Aman', 2: 'Yashvardhan', 3: 'Aditya', 4: 'Siddharth', 5:Arpit'}


The output of keys()- dict_keys([1, 2, 3, 4, 5])
The output of values()- dict_values(['Aman', 'Yashvardhan', 'Aditya', 'Siddharth',
'Arpit'])

Enter the key of that item which have to be deleted4

The output of pop()- Siddharth


The output of popitem()- (5, 'Arpit')
Program8- Write a program to find the sum of the given series up to 10
terms.
𝒙𝟐 𝒙𝟑
𝒙+ + +⋯
𝟐! 𝟑!

Programing:-

x=int(input('Enter the value of x '))


n=10
total=0
fact=1
for i in range(1,n+1):
for j in range(1,i+1):
fact=fact*j
total=total+(x**i)/fact
𝒙𝟐 𝒙𝟑
print('The sum of the series 𝒙 + + + ⋯ is',total)
𝟐! 𝟑!
Output:-

Enter the value of x 9


𝒙𝟐 𝒙𝟑
The sum of the series 𝒙+ + + ⋯ is 134.76123931864157
𝟐! 𝟑!
Program9- Write a program to make a mini ATM machine in which 5
major functions to be calculated:
1-Enter pin if correct then enter for other function
2-Withdraw
3-Mini Statement
4-Check last balance
5-Change pin

Programing:-

pin=1256
a=int(input("Enter Your Pin"))
if a==pin:
print("withdrawl , check statement , change pin")
w="withdrawl"
c="check statement"
d="change pin"
b=input("Enter The Service You Would Like")
if(b==w):
print("100 , 500 , 2000")
e=int(input("Enter The Type Of Notes You Would Like"))
if(e==100):
f=int(input("Enter The Amount Required"))
print("Please Wait")
if(e==500):
g=int(input("Enter The Amount"))
print("Please Wait")
if(e==2000):
h=int(input("Enter The Amount Required"))
print("Please Wait")
if(b==c):
print("Would u like to check ur account balance")
o=input()
if(o=="yes"):
print("Your Remaining Balance Is 200000")
if(o=="no"):
print("Please go back to home page")
if(b==d):
print("Enter Your Current Pin")
p=int(input())
if(p==1222):
print("Enter Your New Pin")
q=int(input())
print("Your Pin Has Been Changed")
else:
print("Incorrect Pin")

else:
print("Your Pin Is Incorrect")
Output:-

Enter Your Pin1256


withdrawl , check statement , change pin
Enter The Service You Would Likecheck statement
Would u like to check ur account balance
yes
Your Remaining Balance Is 200000

Enter Your Pin1256


withdrawl , check statement , change pin
Enter The Service You Would Likechange pin
Enter Your Current Pin
1256
Enter Your New Pin
1546
Your Pin Has Been Changed

Enter Your Pin1256


withdrawl , check statement , change pin
Enter The Service You Would Likewithdrawl
100 , 500 , 2000
Enter The Type Of Notes You Would Like500
Enter The Amount20000
Please Wait
Program10- Write a program to create a dictionary in which key value pair
is your subject(key) and marks(values) of 10th class. Find out the sum and
percentage of your marks and conclude your division according to given
data:
60%-100% - 1st
45%-59% -2nd
33%-44%-3rd
Show your maths and science marks separately. If you got 75% in these
two subject. Then leave a message “You are eligible to take PCM in
class11th” otherwise not.

Programing:-

g=int(input("Enter your English number"))


a=int(input("Enter your Hindi number"))
b=int(input("Enter your Maths number"))
c=int(input("Enteryour Science number"))
e=int(input("Enter your Social Science number"))
f=int(input("Enter your Information Technology number"))

d={}
d["English"]=g
d["Hindi"]=a
d["Maths"]=b
d['Science']=c
d['Social Science']=e
d['Information Technology']=f
print('Your numbers are',d)
h=a+b+c+e+f+g
print('Total Marks-',h)

i=(h*100)//600
print('Your Percentage',i)

if i>=60:
print('Division 1')
elif i<59 or i>45:
print('Division 2')
elif i<44 or i>33:
print("Division 3")
else:
print('You are Fail')

j=b+c
k=(j*100)/200
if k>=75:
print('You are eligible to take PCM in class11')
else:
print('You are not eligible to take PCM in class11')
Output:-

Enter your English number92


Enter your Hindi number94
Enter your Maths number90
Enter your Science number95
Enter your Social Science number95
Enter your Information Technology number97
Your numbers are {'English': 92, 'Hindi': 94, 'Maths': 90, 'Science': 95,
'Social Science': 95, 'Information Technology': 97}
Total Marks- 563
Your Percentage 94
Division 1
You are eligible to take PCM in class11
Output:-

****INPUT****
Enter the length of list10
Enter Value in a list456
Enter Value in a list654
Enter Value in a list987
Enter Value in a list354
Enter Value in a list789
Enter Value in a list951
Enter Value in a list753
Enter Value in a list459
Enter Value in a list624
Enter Value in a list789
****OUTPUT****
The List is [456, 654, 987, 354, 789, 951, 753, 459, 624, 789]
****INPUT****
Enter the value which we have to search987
****OUTPUT****
The enter number 987 is in list. Its index number= 2
INDEX
1. Write a program to draw a pattern of your name in given format by using
for loop
1
12
123
1234

2. Write a program to input three values as sides of a triangle. Check it is a


equilateral triangle, isosceles, scalene or right angled triangle. Also find
the area and perimeter of triangle formed.

3. Write a program to accept the values of height & radius of a cone. Also
find its CSA, TSA and volume.

4. Write a program to satisfy the equation for trigonometric identity.


Sin2x+cos2=1

5. Write a program to make a pattern by using while loop.


1
12
123
1234
12345

6. Write a program to make a list of 10 elements by using user input. Search


an element by user’s choice by using linear search.
7. Write a program to make a dictionary by user’s choice apply pop(), key(),
values() and popitem() functions on it.
After applying every function generate separate output for each.

8. Write a program to find the sum of the given series up to 10 terms.

𝑥+ + +⋯
! !

9. Write a program to make a mini ATM machine in which 5 major


functions to be calculated:
1-Enter pin if correct then enter for other function
2-Withdraw
3-Mini Statement
4-Check last balance
5-Change pin

10.Write a program to create a dictionary in which key value pair is your


subject(key) and marks(values) of 10th class. Find out the sum and
percentage of your marks and conclude your division according to given
data:
60%-100% - 1st
45%-59% -2nd
33%-44%-3rd
Show your maths and science marks separately. If you got 75% in these
two subject. Then leave a message “You are eligible to take PCM in
class11th” otherwise not.
ACKNOWLEDGEMENT

I would like to convey my sincere thanks to


Mr. Kaushal Bahuguna sir, my computer
science teacher,
Who always gave me valuable suggestions and
guidance during the project. He has a source of
inspiration and helped me understand and
remember the important details of the project. He
gave me an amazing opportunity to do this
wonderful project.

I also thank my parents and friends for their help


and support in finalising this project within the
limited time frame.
CERTIFICATE BY STUDENT

I Arpit Purohit, student of class XI Harsil


of Social Baluni Public School.
Hereby certify that the project was undertaken by
me as per the CBSE curriculum. I take it to be
authentic and reliable.

You might also like