How to create a variable in python


#1

how to create a variable?


#2

Are you stuck in the create a variable lesson?

from the create a variable lesson:

For example:

spam = 5

The variable spam now stores the number 5.


#3

I tried this:

spam = 10

but this keeps on showing me error 'to create a variable called my_varaible'
where am I going wrong? Should I write anything else? Can you please help?
thank you


#4

If you're creating a variable called my_variable, then it would look something like this:

my_variable = //whatever it is supposed to equal

#5

Totally agree with @jibblyj, the name of your variable needs to be my_variable to pass the exercise, your variable is currently named/called spam


#6

That's the first time that's happened :wink:


#8

I wrote a few words about this, hope helps you, please follow the link below

Declaring Variable


#9

how do I write a variable for battleship it says
Oops, try again. Did you declare a variable called board?
my code is
board = empty list


#10

empty list is just a word we use to describe a list ([])