Python Forum

Full Version: Invalid Syntax Error
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Greetings all,

I am currently doing some practice, and I am running into an invalid script error. Here is the code. IDLE gives me an invalid syntax error and then highlights a1

print ("Welcome to the Urban Daily")

a1 = "J_Cole"
a2 = "Drake"
a3 = "Jay_Z"
a4 = "Chance"

print(a1, a2, a3, a4)
UserInput = input(print("Select your favorite artist:\n"))

if (UserInput == a1):
    print("You have selected," a1)
elif (UserInput == a2):
    print("You have selected," a2)
elif (UserInput == a3):
    print("You have selected," a3)
elif (UserInput == a4):
    print("You have selected," a4)
else:
    print("Selection is invalid")
there is no separator between the string and the variable
print("You have selected," a1)
use the new python f string
print(f"You have selected, {a1}")
awesome thank you so much for your help!