MadLib Game Using Python


Python Introduction By CodeHind Image

Code For Creating Calculator Using Python

while True:
num1=int(input("Enter the First Number:"))
oper=input("Enter the Operation:")
num2=int(input("Enter the Second Number:"))

if oper=="+":
sum=num1+num2
print("The Answer is:",sum)

elif oper=="-":
subs=num1-num2
print("The Answer is:",subs)
elif oper=="*":
mul=num1*num2
print("The Answer is:",mul)

elif oper=="/":
div=num1/num2
print("The Answer is:",div)

else:
print("Wrong Operation Input!")
print("=========================\n")


Output:

Enter the First Number:10
Enter the Operation:+
Enter the Second Number:20
The Answer is: 30
=========================

Enter the First Number:20
Enter the Operation:-
Enter the Second Number:5
The Answer is: 15
=========================

Enter the First Number:2
Enter the Operation:*
Enter the Second Number:5
The Answer is: 10
=========================

Enter the First Number:12
Enter the Operation:/
Enter the Second Number:3
The Answer is: 4.0
=========================

Enter the First Number: