Skip to content
Variables on python
Profile icon

How do I create a variable with python code so I can do things like

A = 5
print ("A")

which the result is 5

You are viewing a single comment. View All
Profile icon


variable_name = "Value" print(variable_name)

In Python, you can assign any value to your variable.
What's better? Even have you have, lets say a string, assigned to your variable, you can still assign a integer to it and it will change the value compiler

The powers of a dynamic language!

Profile icon

also, these commands are helpful:


However, if a variable is created inside a function, it will only be used inside that function and can never be called anywhere else besides the function itself. if the variable is created on the outside, it can be used with the entire program, but only in the file that it was created in.