Creating a variable -In Python


Total Newbie here -

How am I supposed to create a Variable?
I keep geting asked "Did I create a Variable".

Please can you tell how you create a variable called Dancing?



Easy enough,

# This is a variable
dancing = None

#This is also a variable
dance = ''

# This too
dance = sum

# Another one
sum = lambda x, y: x + y

These are all variables, just decide what type of variable you want, decide on a name and just define it.



I was asked to create a variable called my-string (string - anything)
and my code was

my_string = 100.

Why is that wrong?
Thanks in advance :slightly_smiling:



A string is a data type in python, to see what type of data you have just do



I am just not getting it:

This is the tasks:
On line 3, create the variable my_string and set it to any string you'd like.
On line 4, print the length of my_string.
On line 5, print the .upper() case version of my_string.

My answers:

my_string - "Dancing"
print my_string (len)
print my_string.upper (len)

It gives the error asking 'Did you create a variable called my_string"? I don't get where I am going wring.



I highly recommend you start the whole course over again as you seem to not know the syntax of the language. This time pay attention to the syntax as it is super important to the function of the language.

None of the code you have written is valid at all in any language.

Non-valid Code:

Pay close attention to the syntax of the language.

Once you redo the first few courses you should have a better understanding of what you did wrong. Just remember the mistakes we make only strengthen the learning experience.

So don't dive up just try harder.