import math
import cmath
print("************************************************")
print("Welcome to Numerology!")
print("************************************************")
def addition():
print(a ,"+" ,b ,"=", a+b)
def subtraction():
print(a, "-",b,"=", a-b)
def division():
print(a, "/", b, a/b)
def squareroot():
print("The squareroot of the sum of your numbers is",y)
def cos():
print(a,"cos",b,"=",a*cos(b) )
def sin():
print(a,"sin", b, "=", a*sin(b) )
def multiply():
print(a,"x", b, "=", a*b)
a= int(input("What's your first number?\n"))
b= int(input("What's your second number?\n"))
y= cmath.sqrt(a+b)
s= subtraction
d= division
p= addition
sq= squareroot
c= cos
m= multiply
si= sin
while True:
print("What operator would you like to use?\n s for subtraction, d for
division, m for multiplication, sq for squareroot, c for cos,si for sin, and
p for addition ")
choice = input("Your choice\n")
if choice == "s":
subtraction()
elif choice == "d":
division()
elif choice == "p":
addition()
elif choice == "sq":
squareroot()
elif choice == "c":
cos()
elif choice == "si":
sin()
elif choice == "m":
multiply()
res= input("Would you like to choose a different operator? Yes\No:")
if res == "Yes":
print("What operator would you like to use?\n s for subtraction, d
for division, m for multiplication, sq for squareroot, c for cos,si for sin, and p for addition ")
choice = input("Your choice\n")
elif res == "No":
print("Thank you for using Numerology")
答案 0 :(得分:0)
import math
import cmath
print("************************************************")
print("Welcome to Numerology!")
print("************************************************")
def addition():
print(a ,"+" ,b ,"=", a+b)
def subtraction():
print(a, "-",b,"=", a-b)
def division():
print(a, "/", b, a/b)
def squareroot():
print("The squareroot of the sum of your numbers is",y)
def cos():
print(a,"cos",b,"=",a*cos(b) )
def sin():
print(a,"sin", b, "=", a*sin(b) )
def multiply():
print(a,"x", b, "=", a*b)
a= int(input("What's your first number?\n"))
b= int(input("What's your second number?\n"))
y= cmath.sqrt(a+b)
s= subtraction
d= division
p= addition
sq= squareroot
c= cos
m= multiply
si= sin
while True:
print("What operator would you like to use?\n s for subtraction, d for division, m for multiplication, sq for squareroot, c for cos,si for sin, and p for addition ")
choice = input("Your choice\n")
if choice == "s":
subtraction()
elif choice == "d":
division()
elif choice == "p":
addition()
elif choice == "sq":
squareroot()
elif choice == "c":
cos()
elif choice == "si":
sin()
elif choice == "m":
multiply()
else:
print("Wrong choice")
res= input(r"Would you like to choose a different operator ? Yes\No:")
if res == "Yes":
print("What operator would you like to use?\n s for subtraction, d for division, m for multiplication, sq for squareroot, c for cos,si for sin, and p for addition ")
choice = input("Your choice\n")
elif res == "No":
print("Thank you for using Numerology")
Checkout this link希望它会起作用。