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

41 Program to demonstrate List Functions in Python.

Program: #Functions which can be applied on lists #ex:- len(),max(),min(),sorted(),reversed() x=[60,10,40,30,20,50] print(len(x)) p...
Read More

40 Program to demonstrate List with heterogeneous elements in Python

Program: #list with heterogeneous elements x=[501,6.1,True,"python"] print(x[2]) print(x[3][2]) for p in x:     print(p,ty...
Read More

39 Program to display multiplication tables from 1 t 10 in Python

Program: #program to display multiplication tables from 1 t 10 for i in range(1,11):    for j in range(1,11):       k = i*j       p...
Read More

38 Program to demonstrate range function of For Loop in Python

Program 1: #Range()function: It is a pre-defined function, whose range starts from # 0 to given value(excluding) #ex:- range(10)--->...
Read More

37 Program to printing each character for 3 times in Python

Program: # printing each character for  3 times x='python' for p in x: # p indicates each element of x    i.e p,y,t,h,o,n     ...
Read More

36 Program to demonstrate While loop Continue and Break in Python

Program: while True:     name=input("enter user name:")     if name !='atharva':         continue     password=inpu...
Read More

35 Program to demonstrate while-else and break in Python

Program: #while-else and break x=1 while True:     print("hello")     if(x==5):         break     x=x+1 else:     print...
Read More

34 Program to demonstrate While-Else Loop in Python

Program: #program for while-else x=1 while(x<=5):     print("hello")     x=x+1 else:     print("world") pri...
Read More

33 Program to print multiplication table of a number in Python

Program: #program to print multiplication table of a number n=int(input("Enter a no:")) print("MULTIPLICATION TABLE IS...
Read More

32 Program to find sum of first 'n' no's using while loop in Python

Program: #program to find sum of first 'n' no's using while n=int(input("enter value of n")) x=1 sum=0 while (x...
Read More

31 Program illustrating change in time in Python

Program: #program illustrating change in time time=float(input("Enter current time:")) if(time<=12.00):     print(...
Read More

30 Program to compute total and percentage of 6 subjects and also find the Grade/Class awarded in Python.

Program: s1=90;s2=80;s3=70;s4=85;s5=75;s6=60 total=s1+s2+s3+s4+s5+s6 per=(total/600)*100 print("TOTAL=",total) print(...
Read More

29 Program to find the largest of 3 No's in Python

Program: #Nested blocks #program to find the largest of 3 No's x=int(input("Enter value of x:")) y=int(input("Ente...
Read More

28 Program to find whether a no is even or odd in Python

Program: #program to find whether a no is even or odd x=int(input("Enter a no:")) if(x%2==0):     print(x,"is a Eve...
Read More

27 Program to check whether 2 no's are equal or not in Python

Program: #program to check whether 2 no's are equal or not x=int(input("Enter value of x:")) y=int(input("enter va...
Read More

26 Program to Demonstrate TypeCasting in Python

Program: #Type casting #1. string to int x=input("Enter value of x:") print(x,type(x)) y=int(x) print(y,type(y)) #2...
Read More