My new Quadratic Calcutor

I made a quadratic calculator in replit.
If you find any bugs, make sure to comment.
Make sure to check it out.


I can help with your “j”. I’m not sure why it’s there but here’s how to remove it:

# Your original code

# Simply convert to a string and remove the "j"
print(str(ans1).strip('j') # This will remove every instance of
# the letter "j", which is what we want in this case.

Also, did you know you can make multiline print statements and put variables inside them?

print('Hello\nworld!') # The "\n" is an ANSI sequence that will
# put a new line. Thus, this prints in two lines, split between
# these two words.

phrase = '''Hello
print(phrase) # You can also use a multiline string to do this.
print("The first solution is:-",ans1) # This prints the string, then the
# text after it, separated by a space.

print("The first solution is:- " + str(ans1)) # For this method, you must
# add the space manually to the string.

print(f'The first solution is:- {ans1}') # The f-string allows inline usage
# of a variable. It's my personal favorite.

You can combine these two methods to get the desired result:

print(f'The first solution is:-\n{ans1}') 

Overall, it’s a nice program. Better than my quadratic formula Python program.

Thank you. I was worried about the “j” for a long time.

I tried this, but it doesn’t work. Can you find another way?

print(str(ans1).replace('j', ''))

Also the original doesn’t work because I forgot a parenthesis:

print(str(ans1).strip('j') )

It still does not work. Thank for the suggestion tho

I’m gonna fork it and look into that.

I updated this because I learned that “j” is actually the Python representation of the imaginary number “i”. Thanks @MrVoo1.

This works for me:

# Check if there is only 1 solution
if ans1 == ans2:
  print("The solution is:-")
  print(str(ans1).replace('j', 'i').strip('()'))
  print("The first solution is:-")
  print(str(ans1).replace('j', 'i').strip('()'))
  print("The second solution is:-")
  print(str(ans2).replace('j', 'i').strip('()'))

is the “second solution” supposed to be “ans1”?

Get rid of the *NOTE: Ignore the 'j' message:

1 Like

I fixed it. The point was removing characters not accurate output anyway.

1 Like

Thank you, I will make sure that you are being creditted

1 Like

Thank you, I will make sure that you are being credited

ans1 is the first solution
ans2 is the second solution

1 Like

Cool project @PrabhavKondapal

BTW did you code everything or is GeeksForGeeks like a tutorial website? (also you can’t put letters but maybe that’s because you can’t put variables in quadratics)

1 Like

GeeksForGeeks is a very helpful tutorial website.


Can I get the link? doesn’t work, and honestly, it looks like a malicious website… I think I have the wrong one.

1 Like

The link is:


I don’t get why GeeksForGeeks don’t just get that domain and then redirect to .org it would save confusion, but thanks.

1 Like