Lab 3 Practice
Lab 3 Practice
a = 30
b = 207
if b > a:
print("b is greater than a") # you will get an error
if(x >=18):
print(" eligible to vote")
else:
b= 18-x
print(" not eligible to vote.you have to wait for " ,b )
#7.program to determine whether a numbers are equal or not.
a = 33
b = 33
if b > a:
print("b is greater than a")
elif a == b:
print("a and b are equal")
#11 Ladder if
#Program to enter a number and print its interval (0-10, 10-20, 20-
30, 30-40, 40-50)
#print("invalid number")
#12 Ladder if
#Program to enter a number and print its interval
# 13
""" marks 90-100------------A+
80-90 A
70-80 B
60-70 C
less than 60 D" more efffort required""""
if(num==0):
print("the value is equal to zero")
if(num>0):
print("the value is positive")
if(num<0):
print("the value is -ve")
if(num>=0):
if(num==0):
print("the value is equal to zero")
else: #num>0
print("the value is positive")
else: # num<0
print("the value is -ve")
#17. Write a program to Accept two Integers and Check if they are Equal
.
num1=int(input("enter any number "))
num2=int(input("enter any number "))
if(num1==num2):
print("Both are equal")
z1 = complex(2, 3)
x=int(input("Enter the real value"))
y=int(input("Enter the imaginary value"))
z2 = complex(x,y)
z3=z1+z2
print( "Addition is : ", z3)
z4=z1-z2
print("Subtraction:", z4)
#20.Write a program to print color name, if user enters the first lette
r of the color name.
n=(input("enter first character of color "))
#if elif else
if(n=="r" or n=='R'):
print("Red")
elif(n=="B" or n=='b'):
print("Blue/Black/Brown")
elif(n=="y" or n=='Y'):
print("Yellow")
elif(n=="p" or n=='P'):
print("Pink/Purple")
elif(n=="o" or n=='O'):
print("Orange")
elif(n=="w" or n=='W'):
print("White")
else:
print("invalid color")
print("Select operation.")
print("1.Add")
print("2.Subtract")
print("3.Multiply")
print("4.Divide")
else:
print("Invalid Input")
64. Write a menu driven program for calculating area of different geom
etrical figures such as circle, square, rectangle, and triangle.
name = shape_name.lower()
else:
print("Sorry! This shape is not available")