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 | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 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 Respostas
+ 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