+ 5
Output error
name1 = input("Enter 1st name: ") name2 = input("Enter last name: ") print("Hey! whats up!"+ name1 + " " + name2) The output should be( Hey! Whats up! Name1 name2) But where is the problem?
17 Answers
+ 5
Developers should solve this so that app user can be benefited by using sololearn platform.
+ 3
Mustakim Rahman I run your code..it runs..it didn't show name error ...give name 1 and then press enter and give name 2 then click submit button...try like this
+ 3
It should be like this
name1 = input()
name2 = input()
print (" Hey! what\'s up!" + name1 + name2)
but there is a catch you have to add space at last of name1
please do something with this code mentors
and help me with this too
+ 3
Jony
It may not work because of [ ' ] in what[ ' ]s up
because it will not be excluded and will be treated as element,tag,whatever.
To exclude it you have to use[ \ ] this sign like mine
You can try it in code playground
you can try
+ 2
Mustakim Rahman give name1 and name2 in new line before clicking submit...it won't show EOF error..
+ 2
Mis riya after adding name 1&2 it shows name error
And after using f string it showing invalid syntax
+ 1
I think it’s a bug. However thanks a lot for helping.
+ 1
Use f-string. 👇
name1 = input("Enter 1st name: ")
name2 = input("Enter last name: ")
print(f"Hey! What\'s up, {name1} {name2}")
Just try it 👆, you'll understand
+ 1
Maybe try:
name1 = (input(""))
name2 = (input(""))
print ("Hey whats up!" + " " + name1 + " " +name2 )
+ 1
I think the second added empty string " " space before name1 fixes it.
+ 1
Write in a new line While giving input for last name
+ 1
It doesn't show any problem, you try it on online compiler
0
But it is showing some error in name2 line
0
EOF error brother
0
Try this:
print("Enter 1st name: ")
name1 = input()
print("Enter last name: ")
name2 = input()
print("Hey! what's up!" + name1 + " " + name2)
0
Hey
0
Output error
name1 = input("Enter 1st name: ")
name2 = input("Enter last name: ")
print("Hey! whats up! ", name1 , " " , name2)