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")
            Asked
            
        
        
            Active
            
        
            Viewed 112 times
        
    1
            
            
        - 
                    use `res= input(r"Would you like to choose a different operator? Yes\No:")` AND add exit condition in the end where you are ending program – sahasrara62 Jul 12 '19 at 06:16
- 
                    use else after elif for better design pattern – soheshdoshi Jul 12 '19 at 06:27
1 Answers
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 linkHope It Will Work.
 
    
    
        soheshdoshi
        
- 594
- 3
- 7
- 24
- 
                    
- 
                    Could you please explain what was the source of the error and how you fixed it? – Matthias Jul 12 '19 at 06:51
- 
                    https://docs.python.org/3/reference/lexical_analysis.html#string-and-bytes-literals @Matthias – soheshdoshi Jul 12 '19 at 09:27
 
    