OneBite.Dev - Coding blog in a bite size

create a variable in python

Code snippet on how to create a variable in python

my_var = "Hello World!"

This code creates a new variable called my_var and assigns the value “Hello World!” to it. First, we declare our new variable by typing the name (“my_var”) followed by an equals sign (=). Then inside the quotation marks (""), we type the value we want our new variable to store, in this case “Hello World!“. Finally, we end the expression with a semicolon (;). In this example, our code creates a new variable called my_var with the value of “Hello World!”, and this value can be used throughout the program.

python