How to create a variable in python

how to create a variable?

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.

1 Like

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

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

my_variable = //whatever it is supposed to equal
1 Like

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

2 Likes

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

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

Declaring Variable

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

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