0

When I try to echo a number with an equals sign, this error happens:

    printThis = "=" +str(result)
            ^
SyntaxError: invalid syntax

And I tried to do print("=" +str(result)), it does a similar error.

Can anyone help? Thanks!

EDIT:

elif calc == "base":
    base = int(input('''What base would you like to use?
Available: 2 (binary) 8 (octo) 10 (decimal (normal)) 16 (hex)
Type 2, 8, 10, or 16: '''))
    if base == 2:
        result = bin(input("Type the original number: ")
        printThis = "=" +str(result)
        print(printThis)
6
  • 2
    Your snippet works for me, so please edit your question and add an minimal reproducible example that reproduces this error Commented Nov 25, 2019 at 14:02
  • @OcasoProtal Edited it, try it now Commented Nov 25, 2019 at 14:09
  • 1
    You are missing a parenthesis at the end of result = ... Commented Nov 25, 2019 at 14:10
  • 1
    There is a ) missing, it should be result = bin(input("Type the original number: ")) Commented Nov 25, 2019 at 14:10
  • Thank you @OcasoProtal! It now works! Commented Nov 25, 2019 at 14:19

1 Answer 1

1

close the bracket at the end for the below line in your code

result = bin(input("Type the original number: "))
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.