0

I am trying to have math equations not end up with +0j at the end. This is what I currently have

from cmath import sqrt
a = int(input("insert number: "))
b = int(input("insert number: "))
exp = input("Would you like to have exponents? ")
function = input("Put what kind of equasion you want: ")
if function == "*" or "multiplication" or "MULTIPLICATION" or "Multiplication":
    if exp == "yes" or "Yes" or "YES":
        e = int(input("What number do you want?"))
        root = input("Would you like square root? ")
        if root == "yes":
            c = int(sqrt(a * b))
            d = c ** e
            print(a, "was", function, "by", b, "getting the answer of", c)
        print("Then", c, "was put to the power of", e, "giving the final answer of", d)

When I run it, the final number (which appears where variable d is) ends up have a +0J at the end. What would I need to add or remove to get that to not happen? I was told it might be something with the function variable I have that is causing the problem but I am not sure how I could get the function out of a string.

padaleiana
  • 955
  • 1
  • 14
  • 23

0 Answers0