Showing posts with label CollectionTypePython. Show all posts
Showing posts with label CollectionTypePython. Show all posts

50 Program to demonstrate methods and functions of Dictionary in Python

Program 1: #getting keys and values material={"books":10,"pens":20,"chairs":30} print(material.keys())  #p...
Read More

49 Program for modifying,adding and printing an element of dictionary in Python

Program: #modifying,adding and printing an element of dictionary std={"name":"kumar","height":5.6,"we...
Read More

48 Program for mathematical operations using SET methods in Python

Program: #mathematical operations using set methods A={10,20,30,40,50} B={10,20,60,70,80} print(A) print(B) print(A|B) print(B|A) ...
Read More

47 Program applying functions on SET in Python

Program: #applying functions on set x={40,10,30,20,50} print(x) print(type(x)) print(len(x)) print(sum(x)) print(max(x)) print(min...
Read More

46 Program to create SET object in Python

Program: #creating set object x={10,20,30,40,50}  #homogeneous elements print(x) print(type(x)) y={501,6.1,True,"hello"} ...
Read More

45 Program to demonstrate Type-Casting for Collection Type in Python

Program: #case 1: Converting List to tuple x=[10,20,30,40,50] print(x,type(x)) y=tuple(x) print(y,type(y)) #case 2: Converting T...
Read More

44 Program for tuple with different elements in Python

Program: #tuple with different elements x=((10,20,30),[40,50,60],"hello",4.5,True) #here elements of a tuple can be either mut...
Read More

43 Program to compute sum of tuple elements using for and while in Python

Program: #computing sum of tuple elements using for and while x=(10,20,30,10,50) # using for-loop sum=0 for p in x:     sum=sum+...
Read More

42 Program to demonstrate nested list in Python

Program: x=[[10,20,30],[40,50,60],[70,80,90]] print(x) print(type(x)) print(len(x)) print(x[0],type(x[0])) #1st list print(x[1],ty...
Read More