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
9 Answers
+ 10
Read the previous lesson again. Pay attention to getting user input. Have a close look at which function is used.
+ 5
input means the user type in their name. store it in the variable "name". then use only the variable, not "Mary", not "John"
+ 3
What have you tried so far?
You know that we cannot see your code, don't you? Please link it.
+ 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 ()
+ 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)
+ 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..
+ 1
Thanks
I appreciate you all🤗🤗
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)
0
Pls help me out with the code I don't seem to understand that
I'm a beginner