We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 3
418722, 108 PM PWD lab -Colaboratory
odd or even
num = int(input("Enter a number: "))
if (num % 2)
print("{@} is Even".forat(num))
else:
print("{@} is Odd". format (num) )
Enter a number:
#Hlargest of 3 numbers
azint(input(“enter a number*))
beint(input("enter second nunber"))
caint(input(‘enter third number'))
if arb and av
print("a is greater
elif b>c and boa:
print("b is greater”
else:
print("c is greater")
# prime nos in an interval
asint(input("enter a number"))
beint(input("enter other nunber))
print ("The Prime Numbers in the range are: ")
for i in range(a,b+1):
if ipa:
for i in range (2, number)
if (number % i)
break
else:
print (number)
# multiplcation table
num=int(input ("enter a number"))
print("muliplication table of" num)
for i in range(1,1@):
print (num, "x"
vi, "=", num*i)
# sum of all natural nos
num=int(input(“enter 2 number"))
if nunc
print(“enter a positive number")
else:
sum=0
whi le(num>@) =
sum=sum+num
hitpsseola. research, google.comirvo/XSmgexz0SPqakycoFmKGUFEVWARSsEi#scrolTo=ycOFFUAFCS jAprintMode=truo418722, 108 PM PWD lab -Colaboratory
um=num-1
print("the sum is",sum)
# swapping
P = int( input("Please enter value for P:
Q = int( input("Please enter value for Q:
# To Swap the values of two variables
PLQ=Q@P
print ("The Value of P after swapping: ", P)
print ("The Value of Q after swapping: ", Q)
wh area of triangle
loat(input("enter first sid
‘Loat(input("enter first sid
‘oat (input("enter first side"))
asbec)/2
area-s*(s-a)*(s-b)*(s-c)**0.5
print('The area of the triangle is X0.2f' Xarea)
a pattern
rows = int(input("Enter number of rows: "))
for i in range(rows):
for j in range(i+1)
print("* ", en
print("\n")
w## List is empty
my_list = []
if not my_list:
print("the list is empty")
# element in dict
my_dict = (1: ‘a’, 2:
if 2 in my_dict:
print ("present")
hitpsseola. research, google.comirvo/XSmgexz0SPqakycoFmKGUFEVWARSsEi#scrolTo=ycOFFUAFCS jAprintMode=truo418722, 108 PM PWD lab -Colaboratory
hitpsscolab research. google.comidrivelXSmgd220SPqakycoFmKGUFEVVARSSEHscrollTo=ycOFFUAFCS /printMod