0
Why is Python beginners chatbot v1.1 saying error when my output and expected output is same
28 Antworten
+ 10
I have looked at your code, and found the error. The error is that you forgot to add the space after the coma in the message variable. This can result in an incorrect output, from the code challenge, as they require your output to be exactly same as their output. Here is the solved program:
# Use name as input
name = input()
#Use concatenation to join 2 strings
message = "Nice to meet you, " + name
#Display message to user
print(message)
+ 6
Your code is correct. Maybe there is a mistake in punctuation marks or spellings. If it is also correct then it may be a bug or error
+ 6
I am having issues with this and I cannot move past it I am getting the correct code for Mary but it is not generating the code for the other two people how do I get it to populate the correct code for all three people at the same time so I can pass onto the next lesson?
+ 2
Share the code
+ 2
Solve this for me,
With these names
Mary
Robert
Anna
# Take the name as input
name = input()
# Use concatenation to join 2 strings
message = "Nice to meet you, " + name
# Display the message to the user
print(message)
+ 1
Okay thanks I thought it may be that. Any ideas how to get the error solved?
+ 1
Keturah Cutting no problem, that is the way we learn. Thank you for making my answer as the best answer.
+ 1
It isn't about the specific name. They're asking you to join the 2 strings. Leave the word "name" as it is and fill in the missing symbol(s) to complete the code. Good luck!
+ 1
Keturah Cutting Can you please share the code here?
I'm having problem with it too
+ 1
Keturah Cutting Thanks
+ 1
Only # testcase1 is correct remaining 2 cases have bugss
+ 1
I keep getting test 1 and 2 wrong for some reason but it completes the third one what can I do to rectify that
+ 1
I am getting the correct code for Mary but it is not generating the code for the other two people how do I get it to populate the correct code for all three people at the same time so I can pass onto the next lesson?
0
# Use name as input
name = input()
#Use concatenation to join 2 strings
message = "Nice to meet you, " name
#Display message to user
My answer:
# Use name as input
name = input()
#Use concatenation to join 2 strings
message = "Nice to meet you, " + name
#Display message to user
print(message)
0
This is why it's better to post a link to a code bit, rather than just c/p-ing text. Hard to debug typos that we can't see
0
I would like to do that but I'm on the mobile app not sure how to
0
Oh my Danish Zubair ! You are absolutely correct! I just tried it and after numerous attempts of wondering what was wrong, I got it. Thank you so much! You taught me something here today. Thanks to everyone else who attempted to help as well. Appreciated.
0
Ok so theres three names: Mary, Robert, Anna.
This is what i did for test case #1 and i got it correct.
~ # Take the name as input
message = "Nice to meet you, "
name = "Mary"
# Use the concatenation to join 2 strings
# Display the message to the user
print(message + name) ~
I copied and pasted the exact same as above directly under with spaces and just changed the name to ‘robert’ but it didnt run. In fact test case #1 and #2 didt work?
I have the right solution but cant get all three right simultaneously
0
If you go up in the comments, you'll see it was posted by Danish Zubair.
You leave the first line of code as is.
You leave everything they gave you in the second line of code as is including the space between (you,) and the quotation mark (") and just add the plus sign (+) before the word "name".
For the third line you simply: print(message)