Pls i need help with the code to use under python | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

Pls i need help with the code to use under python

Modify a code to display a friendly message to the user. Use string concatenation to join strings together and display a personalized friendly message. Expected output: 1. Nice to meet you , Mary 2. Nice to meet you, John

10th Jun 2023, 7:05 PM
Emmy~tech
Emmy~tech - avatar
9 Answers
+ 10
Read the previous lesson again. Pay attention to getting user input. Have a close look at which function is used.
10th Jun 2023, 7:19 PM
Lisa
Lisa - avatar
+ 5
input means the user type in their name. store it in the variable "name". then use only the variable, not "Mary", not "John"
10th Jun 2023, 7:58 PM
Lisa
Lisa - avatar
+ 3
What have you tried so far? You know that we cannot see your code, don't you? Please link it.
10th Jun 2023, 7:11 PM
Lisa
Lisa - avatar
+ 1
You need to take input instead of hard-coding the name as "Mary". Get input an store it in the variable "name" Remove the blank space between print and ()
10th Jun 2023, 7:15 PM
Lisa
Lisa - avatar
+ 1
# Take the name as input name = input() input = "Mary", "John" message = "Nice to meet you, " + "Mary" # Display the message to the user print (message) How.cam I include the second name (John)
10th Jun 2023, 7:55 PM
Emmy~tech
Emmy~tech - avatar
+ 1
Emmanuel Ehem. First, we hardly ever use a string variable to store more than 1 string. Second, the "Mary" string in the message variable, is not the input string you provided. So, to fix this, we use multiple variable to store multiple strings, each variable stores 1 string. person1 = "Mary" person2 = "John" #Some code goes here.. Or we can use it without assign it to a variable, if it doesn't affect to the code..
11th Jun 2023, 6:16 AM
Dragon RB
Dragon RB - avatar
+ 1
Thanks I appreciate you all🤗🤗
11th Jun 2023, 4:23 PM
Emmy~tech
Emmy~tech - avatar
0
# Take the name as input name = "Mary" # Use concatenation to join 2 strings message = "Nice to meet you, " + "Mary" # Display the message to the user print (message)
10th Jun 2023, 7:13 PM
Emmy~tech
Emmy~tech - avatar
0
Pls help me out with the code I don't seem to understand that I'm a beginner
10th Jun 2023, 7:18 PM
Emmy~tech
Emmy~tech - avatar