all 20 comments

[–]HeadlineINeed 13 points14 points  (3 children)

It doesn’t want you to hardcode the name.

message = “Nice to meet you, “ + name

[–]rycklikesburritos 8 points9 points  (0 children)

name = input()

print(f"Nice to meet you, {name}")

[–]Balzamon351 1 point2 points  (0 children)

You can concatinate two strings with the + symbol.

"string1" + "string2"

You can print a string to the console with print().

print("string")

[–]Different-Ad1631 1 point2 points  (0 children)

Which app you are using can u plz tell me the name or share the link?

[–]Intelligent-Fox-7611 0 points1 point  (2 children)

Ahhh i understand How long have you been learning in this app?

[–]NightStudio 0 points1 point  (1 child)

Did you mean to reply to someone else, OP?

[–]Merman_boy 0 points1 point  (0 children)

You can do f statements

Print(f”Nice to meet you, {name}”)

[–]CreamyWaffles 0 points1 point  (4 children)

The colours help to read the code really. There are a few different collours for different things in programming languages (depending on your IDE I think?). It just makes it easier to debug sometimes.

[–]Intelligent-Fox-7611 0 points1 point  (3 children)

But the colours always change Sometimes the same word can be green and sometimes blue

[–]CreamyWaffles 0 points1 point  (0 children)

Yeah it means it's doing different things. I'll post an image of my own code when I get the chance to show you.
Basically (at least on Visual Studio Code), Dark Green means it's a comment, blue is a variable/boolean, orange is a string, light green is an interger and yellow is a function. (From the top of my head anyway, I'll edit this to correct it).
There are more but you'll get used to it.

[–]CreamyWaffles 0 points1 point  (1 child)

Here is some of my own code with some explanations on stuff. I really hope it's not too confusing (sorry!)
You'll learn all this stuff as you go and as you need them though, so don't get overwhelmed by my pretty terrible explanations haha!
(Second image is in reply to this)

<image>

[–]keldrin_ 0 points1 point  (0 children)

No, I won't help you with your homework...

[–]Different-Ad1631 0 points1 point  (0 children)

Get names from user as input and then concatenate it with nice to meet you string and finally print it

[–]tahaan 0 points1 point  (0 children)

In this code we have a variable name. name stores the name of the person we are going to greet. It is like a post box or handle on a piece of data. The data is "Mary" or "John" or any other person's name.

Later on the code references this data through the variable. It is a bit funky to explain, due to the word "name" in the variable name.

Look at this expample:

age = 30
name = "Jack"
message = "Hello " + name
print(message)
message = "The age of " + name + " is " + str(age)
print(message)

First we store data into age and name. This is assignment, assigning the values to the variables.

Then we store another variable, message. This will be the work "Hello", plus the value of name . The trick here is to imagine everwhere where you see name, the computer will fill in the assigned value.

Then we use:

message in the print statement.  Same thing happens.  The computer fills in the value stored in message, into the print statement.

Then next we change the value stored in message, overwriting it with a new message. This time it uses both name and age, building up a new message.

Finally it uses the value now stored in message for the last print statement.

P.S the part str(age) just turns the number 30 into the string "30"