1/16 exercise of python


Create a new variable brian and assign it the string "Hello life!".
1/16 exercise of python

I am struck here
I have tried
name = "brain"

I still keep on getting error message as did you create variable called brain
Please help me try make combinations does not work.


I will use your code as an example, ok? :smile:

name = "brain"

This code creates new variable (or if this variable exists it just assigns new value) called name and sets its value to string "brain".

So, the left side of the operation is a name of the variable, right side is the value.

Instructions says:

Create a new variable brian and assign it the string "Hello life!"

Left side of operation should be brian and the right side "Hello life!".

If this explanation is insufficient just let me know.


Thanks for your response.

I tried
brain = "Hello life!"

But still I receive the same error - Did you create variable called brain


According to instructions and to the error message:

"Did you create a variable called brian?"

It should be brian, not brain.


Yes I created the variable brian
Heres my program

variable = brian
brian = "Hello life!"

still same error


What is the purpose of the first line of your code.

At this line variable brian is undefined, so it causes an error.

Your second line is correct, but you should delete the first line.

Sorry, but I don't think that I can help you. You definitely should get back to the first section of this course -> https://www.codecademy.com/courses/introduction-to-python-6WeG3/0/2


I found the answer...

var = "brian"
brian = "Hello life!"


What is the purpose of the first line of your code?


You are setting your first variable to "brian" like it asked in the directions.
"Create a new variable brian"


Instruction says:

Create a new variable brian and assign it the string "Hello life!".

All you need is:

brian = "Hello life!"

Nothing more :smile:

Your first line creates variable var, not variable brian and you have set its value to "brian", but this line is completely redundant.


But my answer still works too sooooo.


Sure, kudos.

But don't you think that we all should try to give the best possible answers? That is the reason why I have written my comment.

You have created two variables because you forgotten the correct syntax. I understand this, but I didn't write my comment to offend you in any way. I just think that it might be kind of dangerous to share badly written code as a correct answer :smile:


Along with that factoradic said, if you want to create multiple variable you cant do
var = "name"
name = "thing"
var = "another_name"
another_name = "another thing"

since that will just change the first 'var' to the second one.

also all it does it create a useless variable


brian = "Hello life"


All I keep getting is

Oops, try again. It seems that Brian has value "Hello life." instead of "Hello life."

I can't move on even though I have tried refreshing, rewording, capitals, lower case, commas, full stops, exclamation marks etc.


Well, it should be "Hello life!", post your code.


hi man am also stack here exercise 16 of python.help me please.
arcpro38645 arcpro38645
February 5
print len("My_String")
print my_string.upper()
in the console i get PARROT
none. why cant i continue please help ,me


I think that you should print out length of string stored inside variable my_string.

So it should be:

print len(my_string)

my_string is a variable, "my_string" is string (a plain value).


i kept having trouble with this too. What worked for me was:
brian="Hello life!"

^brian's name needs to be all lowercase.


Hey guys. i had this same problem and i fixed it. On line 1 it says #Set the variable brian on line 3!
Make sure there is nothing else written before or after that comment of instructions. Otherwise you will get an error message. I think it's a typo error by code academy. Because it was like that when the lesson started even after refreshing it!

This is exactly how everything should look:
1 #Set the variable brian on line 3!
3 brian = "Hello life!"