Variable in Math


#1

I'm getting an error when I try to name my variable. I have:

variable = count_to
count_to = addition
addition = X + Y
Print count_to

it says that the variable "count_to" is not defined in line 2
https://www.codecademy.com/courses/introduction-to-python-6WeG3/3/1?curriculum_id=4f89dab3d788890003000096#

I'm not super familiar with python, obviously, but I'm sure this is a simple fix.


#2

Please include a link to the exercise so that we can then move it to the right forum category.


#3

To define a variable, write the name on the left side of the equals sign, and assign it a value on the right hand side.

count_to = value or expression

#4

it is still returning that what is on the right hand side of the "=" sign is not defined.
in the new case:
count_to = variable_name
addition = count_to
addition = 2 + 2
print count_to

"variable_name" is not defined


#5

variable_name is not defined means it has no value. What do the instructions ask us to do?

count_to = 3 + 4

That should be all you need for this exercise.


#6

I'm having a similar problem and am unsure of what to do. I've tried out everything suggested by those who have responded, but continue to get an error message. What's wrong?


#7

I have figured out what it is asking of us to do.

I wrote
variable_name = 76 + 36
count_to = 76 + 36
addition = 76 + 36
print count_to


#8

So what the actual instructions on the right are telling you is that in order to perform an addition/any function, you must set the variable (in this case count_to) equal to the thing you want calculated. The words describing each function are variables themselves. The word "addition" used is no different than an X, Y, or Count_to.

For example, if you want to find what 3 times 5 is, then you input:
X = 3 * 5
for addition:
X = 3 + 5
where "X" is whatever variable you want to report.

So for this case, we input: count_to = X + Y. Then print our variable: count_to.


#10