0

Help with code coach 37.2 "Welcome, Solo learner!" in Python for Beginners please.

I know I'm missing something and it's probably so easy that I'll kick myself for not catching it, but could I get another set of eyes on this please? The problem: We have a function that outputs "Welcome, user" as it is called. We want to make it more personalized, so redesign the given function so that it will take the name of the user as input and output the welcome message with it. Sample Input Tommy Sample Output Welcome, Tommy My code: def welcome(name): print("Welcome,"+name) name = input () welcome(name) Any help would be very much appreciated!

2nd Feb 2022, 8:53 PM
Corey Karimian
Corey Karimian - avatar
11 Answers
+ 3
This following code should work: def welcome_message(): name = input() print("Welcome, "+ name) welcome_message()
30th Jul 2022, 5:00 PM
A C
+ 1
Thank you! It was the space, you were right. I knew it would be something stupid easy that I had overlooked
2nd Feb 2022, 10:25 PM
Corey Karimian
Corey Karimian - avatar
0
6th Mar 2022, 2:38 PM
Nikhila
0
Try this: user=input() def welcome(): print("Welcome,",user) welcome()
30th Mar 2022, 3:13 PM
Fathima Sahla
0
For me it's printing welcome Bob
9th Aug 2022, 5:30 PM
Blesson Xaviour
Blesson Xaviour - avatar
0
Can any one help me
9th Aug 2022, 5:30 PM
Blesson Xaviour
Blesson Xaviour - avatar
0
def welcome_message(): name = input() print("Welcome,",name) welcome_message()
31st Dec 2023, 6:48 PM
Mahima Bhardwaj
Mahima Bhardwaj - avatar
0
def welcome_user(name): print("Welcome,",user_name) # Example usage: user_name = input() welcome_user(user_name) This is the original answer!!!! I got it.. And you can just try it out.
30th Apr 2024, 2:33 PM
ARJUN R
ARJUN R - avatar
- 1
May be space missing : try print("Welcome," , name) or print("Welcome, "+ name)
2nd Feb 2022, 9:12 PM
Jayakrishna 🇮🇳
- 1
def welcome_message(): name = input() print("Welcome,",name) welcome_message() done...!
6th Mar 2022, 2:32 PM
Nikhila
- 1
def welcome_message(): name = input() print("Welcome,",name) welcome_message() This is Correct...
22nd Oct 2022, 2:44 AM
MI Rushdy Ahamed