Strings stuck


#1

Hello there,

I've started taking courses here and got stuck on Strings. The exercise is to Create a new variable brian and assign it the string "Hello life!". I think I did everything right, but I'm still receiving same error as the variable was not created. Please advise. I have attached my code


#2

There should be a variable by the name brian

And it should refer to the string "Hello life!"


Right now you've created two variables, name and str.
str normally refers to the string class, you should not change that.


#3

If I leave it as name = "brian" and submit the code, I receive an error. Did you create a variable called brian?


#4

If I do:

a = 'b'

Then I have created the string 'b' and the variable a.
I have assigned that string to a.

Which information are you storing as data, and what name are you supposed to use to refer to that data?


#5

I have to create variable brian therefore brian is data.


#6

That's where you're going wrong! The data is "Hello life!"


#7

so I didn't understand the instructions :slight_smile:
Thanks a lot, I am good now


#8

Hello Everyone! I have the same challenges as stated above. I get error message anytime I run the code.

set the variable brain on line 3!

brain = "Hello life!"

I get an error message saying "Did you create a variable called brain"


#9

Still Not clear!!!
Someone, please paste the actual answer here; Will understand in a better way!


#10

This is against the guidelines. We cannot just give you the answer. If you need help, ask specific questions.


#11

ok.i know how to assign a string to the variable. But, can you please tell me how to create a variable

.


#12

The assigning a variable is the creation of a variable. If I assigned a string to variable, like so:

x = "this is an example"

I just created a variable called x. Variables are created the first time they are assigned. It doesn't even have to be assigned to a string, it could be assigned to a list:

x = ["a", 2, "c"]

an integer:

x = 42

a boolean:

x = True

the result of a operation:

x = 12 + (13 - 2)

etc.


#13

oh god. All this time I was reading it as bra**i**n ..not br**i**an


#14