What is a variable in programming?

2.26K views

What is a variable in programming?

In: Other

11 Answers

Anonymous 0 Comments

A variable is basically a name of an information.

So for example

num = 4

would (in python) declare the variable “num” to have the value 4. So you could do stuff with that like:

eight = num + num

where each “num” has the value 4 and so the result has the value 8. This can also be used to declare stuff in advance for example:

x = input()
y = input()
result = x+y

as the time of writing this you don’t know what value “x” or “y” will have as they are getting their value from the user input but whatever the user inputs, the program will try to add the 2 together.

You are viewing 1 out of 11 answers, click here to view all answers.