CodeNewbie Community ๐ŸŒฑ

Natalie
Natalie

Posted on

How do I create a variable in Python?

Hi all! I'm working on learning a little Python, but it's syntax is throwing me - I come from more a JS background.

How do I create a variable in Python?

Thanks!

Latest comments (3)

Collapse
 
preshh0 profile image
Your .py Princess!

You just use:

variable_name = 'Name', for strings
variable_name = 1, for numbers. Those one don't carry quotes.

Collapse
 
bandeirademelo profile image
Bandeira

One of the coolest things about python is how simples it's syntax is:

name_of_variable = value

cat = "Jack"

Collapse
 
kaitheceo profile image
Kai Lyons

Hello! Wonderful question!

The simple syntax for a variable is:
variable_name = value

EXAMPLES:
name = "Kai"
is_true = True
zero = 0

Hope this helps!