You are on page 1of 2

Make a Calculator

Code:

print("##### ***Welcome to My calculator*** ##### \nBy Affan")


n1=int(input("Please Enter number 1: "))
n2=int(input("Please Enter number 2: "))
print ("the type of n1 is ", type(n1))

print ("the type of n2 is ", type (n2))


print ("The answer of addition of two numbers are",n1+n2)
print ("The answer of multiplication of two numbers are",n1*n2)
print ("The answer of subtraction of two numbers are",n2-n1)
print ("The answer of division of two numbers are",n2/n1)
print ("The answer of division without float of two numbers are",n2//n1)
print ("The answer of cube of number 1 is",n1**3)

Indexing Code:

a=('''\"Welcome\"''')
print(a)
apple = '''Hi Affan, how are you
are you learning python
keep up the good work'''
print (apple)
for character in apple:
print(character)

coded of time:

a=int(input("Please enter your current time: "))


b=str(input('''Please enter "am or "pm" of your city: '''))
if (11>=a>0 and b=="am"):
print("Good Morning Sir")
elif (17>=a>=12 and b== "pm"):
print ("Good afternoon Sir")
elif (20>=a>=18 and b== "pm"):
print ("Good Evening Sir")
elif (24>=a>=21 and b== "pm"):
print("Good Night Sir")

a=int(input("Please enter your current time: "))


if (11>=a>=0):
print("Good Morning Sir")
elif (17>=a>=12):
print ("Good afternoon Sir")
elif (20>=a>=18):
print ("Good Evening Sir")
elif (24>=a>=21):
print("Good Night Sir")
else:
print("Please enter a valid time")

You might also like