Showing posts with label LoopsinPython. Show all posts
Showing posts with label LoopsinPython. Show all posts

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

13 Program that takes a number and checks whether it is a Palindrome or not using python

Program: num = int(input("Enter any number:")) onum = num rnum = 0 while num > 0:     rem = num % 10     rnum = (rnum *...
Read More

12 Program takes in a number and finds the sum of digits in a number using Python

Program: num = int(input("Enter any number:")) onum = num snum = 0 while num > 0:     rem = num % 10     snum = snum +...
Read More

11 Program to reverse a given number using Python

Program: num = int(input("Enter any number:")) onum = num rnum = 0 while num > 0:     rem = num % 10     rnum = (rnum *...
Read More

10 Program to calculate factorial of a number using python

Program: num = int(input("Enter any number:")) fact = 1 for i in range(0,num):     fact = (fact * i) + fact print(fact) Ou...
Read More

9 Program to print Fibonacci Series using Python

Program: num = int(input("Enter any number:")) f0 = 0 f1 = 1 f2 = 1 for i in range(num):     print(f0,end="  ")   ...
Read More

8 Program to print all even numbers between 1 to 100 using while loop in Python

Program: i = 1 while i <= 100:     if i %2 == 0 :         print(i,end="  ")     i+=1 Output:
Read More