How do you make a variable in python?


#1

Hi, how do you add a variable in python?
I am new to codecademy.

Thank you,
PantsOnFire08


#2

nameOfVariable = valueOfVariable;

For example:

name = "Maciej"    # a string value
age = 23           # integer value
height = 1.78      # float value

#3

@pantsonfire08 It's simple to ad a variable on Python, in fact I think it's one of the easiest it you do it right. assigning a variable a value is shown below:


variable = value

Make sure that the variable is always on the left-hand side, as the right-hand side is reserved for the value. Also, the equal sign does not mean the same as it does in math. This equal sign is used to assign values, and a double equal sign such as the one below:

==

is used to say something is equal to something else, as used in math.

Hope that helps! :slight_smile: Let me know if you are still confused after this.

--- @chipjumper36731


#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.