How do define a variable?


#1

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


#2

Please leave some info about what you're doing.


#3

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]

#4

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.


#5

Sorry for the confusion. I edited my comment.