0

syntax error what did i wrong

Hello there, I was trying this (python) code here: input: 1 name = input("enter your name: ") 2 print('Hallo '(name)', and welcome in "the Invisble House".') output: File "..\Playground\", line 2 print('Hallo '(name)', and welcome in "the Invisble House".') ^ SyntaxError: invalid syntax but It did'nt work and I don't know what I did wrong. so my question is what did I wrong and Why did'nt it work?

25th Jul 2017, 8:28 PM
sebastiaan
9 ответов
+ 2
it should be name = input("Enter your name: ") print ("Hallo " + name + ", welcome to 'the Invisible House.'")
25th Jul 2017, 7:49 PM
God Usopp
God Usopp - avatar
+ 1
sorry, I forgot to say it was written in python. and yes hallo should be hello.
25th Jul 2017, 8:26 PM
sebastiaan
+ 1
OK in that case I don't believe you do need a semicolon at the end of your statements. However, could someone more knowledgeable about python confirm that.
25th Jul 2017, 8:30 PM
josh mizzi
josh mizzi - avatar
+ 1
@god usopp, I am not saying that it is. I am asking whether python statement SHOULD end in a ; to mark the end of the statement like in Java. I have reached the conclusion that they don't.
25th Jul 2017, 9:01 PM
josh mizzi
josh mizzi - avatar
0
also I don't know if it's intentional but Hallo should probably be Hello
25th Jul 2017, 7:55 PM
God Usopp
God Usopp - avatar
0
What language is this in? Should there be a ";" at the end of statements ?
25th Jul 2017, 8:11 PM
josh mizzi
josh mizzi - avatar
0
@josh mizzi it's not a semicolon it's a period (.) and then single quote closing (').
25th Jul 2017, 8:22 PM
God Usopp
God Usopp - avatar
0
@josh mizzi As I've said before, it's not a semicolon it's a period (.) and a single quote closing ('). It just looks like a semicolon because they are right after each other '. or .' vs ;
25th Jul 2017, 8:41 PM
God Usopp
God Usopp - avatar
0
@josh mizzi correct, they don't
25th Jul 2017, 9:04 PM
God Usopp
God Usopp - avatar