Why not just put my name in the string?

Good question for a newbie programmer, the answer would be… best to use variables sometimes for programs. imagine the script is much longer and your name appears at other areas. instead of updating all those lines of code you just update the variable at the top. It would save time and cascade to the rest of the code.


Thanks, this answer is much more make sense for a newbie.


Yes, but the point of the lesson was to show the usefulness of a computer program. When variables are used, the user can just input a name into the variable and then the program will print a message containing the name. If a different name is entered, a different message will be printed back. A computer program is only useful if it responds to user requests.

If you want to have all the code on one line, you can use a semicolon to divide the two code pieces like this: But it is not recommended as it makes the code harder to read.

my_name = "Codecademy"; print("Hello and welcome " + my_name + "!")


He who asks a question is a fool for five minutes; he who does not ask a question remains a fool forever.

-Chinese Proverb


Malcom Mcginty i need help

If you’re looking for help from the community I encourage you to view the following FAQ which details how and where to ask your question in order to get the best chance at a response-

Since this a rather dated thread it may be worthwhile adding a new query unless it directly relates to the posts above.

I love this python learning, but learning by self is the greatest task since some of us come from poor families that can’t afford paying for university


trust me, ive payed thousands to learn something I could do myself
you are doing yourself a favor by learning it on your own


Your name here is a variable and should be defined before using it. Here, we’re printing, but in the future, we’ll be manipulating variables in other ways. Using this method, we can easily import a long list of variables for various functions.

1 Like

I guess you can also use MyName?

1 Like

Merci beaucoup pour tout

I am new into the world of coding and programming. Having said that I think I have just passed the phase to understand why variables are used and their importance. From my personal experience, I don’t think a small program like this, allows us to understand the importance of a variable or what is the practical use of a variable. I have always wondered, what’s the need of variable when I can type in manually (infact I have to do it in this program). Only after studing and observing referrences, I truly realized the practical importance of a variable.


Would somebody clarify how some text has different colours than others?

1 Like

It’s called, ‘syntax highlighting’. It helps us to spot syntax/typing errors.


To follow up on what @mtf said, you might find the following link useful to learn more about Python 3 Syntax; https://www.codecademy.com/learn/paths/data-analyst/tracks/dacp-python-fundamentals/modules/dscp-python-syntax/cheatsheet and [Cheat Sheet] Basic Python 3 Syntax Explained with Code and Examples

Yep! Could call the variable anything, really. As long as it makes sense to yourself and anyone else who has to read your code.

Eventually what goes into the “My_Name” will be populated dynamically from a database. That’s why we define it as a variable titled “My_name”. This is laying the foundation to build off of later.



if it makes you feel better, even though I went to university, 90% of my learning was self taught because our professors had thick accents or would ramble on as though we already knew everything. Like if he was teaching us functions, he’d talk about “the return type” as though we were supposed to know what a type was or what a return is. This WAS stuff I happened to know since I already knew about coding before starting my degree, but I have no doubts it overwhelmed a lot of beginners with the way they taught everything.


You Could put your name
within the print program
if You did
and Your name was 26ub1313uc26
you would simply command

print("hello and welcome "+"26ub1313uc26 "+"!")

it does make me feel better thank you. :+1: