How do define a variable?


I can't define the cats variable!!!!!


Please leave some info about what you're doing.


Defining a variable is like:

variable_name = expression

Expression can be for example a value of type int,string,list,float etc.

Examples for assignments:

For int

aNumber = 10

For string (formatted)

aString = "New World"
aStringAddition = "Brand"
aFormattedString = "New String: %s %s" % (aStringAddition, aString)

For string (not formatted)

aString = "New World"

For list

aList =  ["Hello", "World", 1]


cats = anything you want

Do you mean,

cats = "anything you want"

? Or,

anything = "anything"
you = "you"
want = "want"

cats = "%s %s %s" % (anything, you, want)

print cats

? I think you get my meaning. Glib responses often lead to confusion. We should always clarify.


Sorry for the confusion. I edited my comment.