0% found this document useful (0 votes)
2 views2 pages

Python My Calculator

The document describes a simple calculator program that allows users to perform basic arithmetic operations such as addition, subtraction, multiplication, division, and exponentiation. Users are prompted to enter a number corresponding to the desired operation and then input the required values for calculation. The program outputs the result of the operation based on user input.

Uploaded by

harshyudi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views2 pages

Python My Calculator

The document describes a simple calculator program that allows users to perform basic arithmetic operations such as addition, subtraction, multiplication, division, and exponentiation. Users are prompted to enter a number corresponding to the desired operation and then input the required values for calculation. The program outputs the result of the operation based on user input.

Uploaded by

harshyudi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

print(" \t\t\t\t\t\t\t My calculator")

print("\n***********************")
print("Enter:")
print("Eight for finding a+b")
print("Seven for finding a-b ")
print("Nine for finding a*b")
print("Eleven for finding a/b")
print("Six for finding a^b")
print("Four for finding the value of x from a quadratic equation ")
print("***********************")
X=input("Enter: ")
if X:=8:
print("***********************")
print("Sum of two numbers")
a=input("Enter First Number: ")
b=input("Enter Second Number: ")
print(float(a)+float(b))
elif X:=7:
print("***********************")
print("Difference between two numbers")
f=input("Enter First Number: ")
g=input("Enter Second Number: ")
print(float(f)-float(g))
print("***********************")

https://www.programiz.com/online-compiler/0uyzlegV3H3UP

print(" \t\t\t\t\t\t\t My calculator")


print("***********************")
print("Enter:")
print("Eight for finding a+b")
print("Seven for finding a-b ")
print("Nine for finding a*b")
print("Eleven for finding a/b")
print("Six for finding a^b")
print("Four for finding the value of x from a quadratic equation ")
print("***********************")
x = int(input("Enter: "))
if 7 < x < 9:
print("***********************")
print("Sum of two numbers")
a=float(input("Enter First Number: "))
b=float(input("Enter Second Number: "))
print("Answer")
print(float((float(a)+float(b))))
elif 6 < x < 8:
print("***********************")
print("Difference between two numbers")
f=float(input("Enter First Number: "))
g=float(input("Enter Second Number: "))
print("Answer")
print(float(float(f)-float(g)))
print("***********************")
elif 8 < x < 10:
print("***********************")
print("Product of two numbers")
i=float(input("Enter First Number: "))
o=float(input("Enter Second Number: "))
print("Answer")
print(float(float(i)*float(o)))
elif 10 < x < 12:
print("***********************")
print("Division of two numbers")
i=float(input("Enter First Number: "))
o=float(input("Enter Second Number: "))
print("Answer")
print(float(float(i)/float(o)))
print("***********************")
elif 5 < x < 7:
print("***********************")
print("To find a^b ")
i=float(input("Enter the value of base: "))
o=float(input("Enter the value of power: "))
print("Answer")
print(pow(float(i),float(o)))
print("***********************")

https://www.programiz.com/online-compiler/4m6HMJSB3zwvA
https://www.programiz.com/online-compiler/9eYCUodU58HzD
https://www.programiz.com/online-compiler/0uy2oOIv0Hnix

You might also like