



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
it contains some assignments python programmes
Typology: Assignments
1 / 5
This page cannot be seen from the preview
Don't miss anything!
(Established under the Presidency University Act, 2013 of the Karnataka Act 41 of 2013)
NAME : MEGHANA SS ROLL.NO : 20201CSE PROGRAM & SEC : CSE (3CSE8) #PROGRAM 1 : my_list = ['M','E','G','H','A','N','A','S','S'] my_list.pop( 0 ) my_list.pop( 4 ) my_list.pop( 5 ) print("MY LIST OF ELEMENTS AFTER REMOVING 0TH,4TH AND 5TH ELEMENTS ARE : ",my_list)
→ OUTPUT : MY LIST OF ELEMENTS AFTER REMOVING 0TH,4TH AND 5TH ELEMENTS ARE : ['E', 'G', 'H', 'A', 'A', 'S']
#PROGRAM 2: s = input("Enter The String : ") if len(s) < 2 : print("") else: str = s[: 2 ] + s[- 2 :] print(str)
→ OUTPUT Enter The String : python :
Pyon
#PROGRAM 3: x = [] for i in range( 1 , 11 ):
if (i% 2 == 0 ): x.append(i) tup1 = tuple(x) print(tup1) tup2 = ( 1 , 3 , 5 , 7 , 9 ) tup = tup1 + tup print(tup) print("THE LENGTH OF TUPLE IS : ",len(tup))
→ OUTPUT : (2, 4, 6, 8, 10)
(2, 4, 6, 8, 10, 1, 3, 5, 7, 9) THE LENGTH OF TUPLE IS : 10 #PROGRAM 4: n = int(input("Enter the number ")) prime_nos = [i for i in range( 2 ,n+ 1 )if all(i%j != 0 for j in range( 2 ,int(i**0.5)+ 1 ))] print(prime_nos) → OUTPUT : Enter the number 50 [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47]
#PROGRAM 5: n = int(input("enter the number of patient ")) INFANT = [] CHILD = [] TEENAGER = [] ADULT = [] SENIOR_CITIZEN = [] for i in range( 0 ,n): age = float(input("Enter the age of patient :")) if age>= 0 : if age< 2 : INFANT.append(age) elif age> 2 and age<= 9 : CHILD.append(age) elif age> 10 and age<= 17 : TEENAGER.append(age) elif age> 18 and age<= 59 :
n=int(input("Enter the number items brought by Ravi ")) for i in range(n): item1=(input("Enter the item name ")) a=item1.upper() if a in items.keys(): pricelist1.append(items[a]) pricelist2=[] m=int(input("Enter the number items brought by Raja ")) for j in range(m): item2=(input("Enter the item name ")) b=item2.upper() if b in items.keys(): pricelist2.append(items[b]) print(sum(pricelist1)) print(sum(pricelist2)) total=sum(pricelist1)+sum(pricelist2) print("The total amount paid by Ravi and Raja is:",total)
→ OUTPUT : Enter the number items brought by Ravi Enter the item name sugar 11 Enter the item name jam Enter the item name tea powder Enter the i Enter the item name cheesetem name cornflakes Enter the item name bournvita Enter the item name biscuit Enter the item name bread Enter the item name sugar Enter the item name rice Enter the item name dal Enter the number items brought by Raja Enter the item name sugar 9 Enter the item name jam Enter the item name cheese Enter the item name bournvita Enter the item name tea powder Enter the item name cornflakes Enter the item name cheese Enter the item name bournvita Enter the item name milk (^732850) The total amount paid by Ravi and Raja is: 1582
COLAB LINK : https://colab.research.google.com/drive/1gVDYD2WYGtBI2TpCqVHCtu63G341BI qp?usp=sharing