TheTechRobo
TheTechRobo

Reputation: 1384

Python syntax error when setting variable

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)

Upvotes: 0

Views: 902

Answers (1)

Praveen Kumar
Praveen Kumar

Reputation: 88

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

result = bin(input("Type the original number: "))

Upvotes: 1

Related Questions