+ 1

I created a variable with the it called as "name". I need to congregate it with a string before it and a string after it

code: print ("Enter name.") name = str(input()) print ("Hi!, my name is chatbot 1.0. Is "+ name" your name?") __________________________________________________________________ it shows "syntax error" in the print statement at the quotation mark at the start of the print statement..

16th Dec 2023, 4:15 PM
Veera Ishaan
Veera Ishaan - avatar
2 odpowiedzi
+ 2
Veera Ishaan You just need to concatenate the variable called name to “ your name?” Like this: print(“Hi!, my name is chatbot 1.0. Is “ + name + “your name?”
16th Dec 2023, 4:44 PM
Junior
Junior - avatar
0
Veera Ishaan , Please add a Python tag to the discussion. input() returns a string, so you don't need to convert it to a string. # redundant name = str(input()) # efficient name = input()
17th Dec 2023, 8:02 AM
Rain
Rain - avatar