0
Variables
Can anyone explain me what is variables
2 ответов
+ 3
Think of a variable as a box. Inside that box is some information, we will call that the value.
Every variable has a value.
When you write a program, you will use a variable to hold a value. Every variable has a name and a value.
my_number = 5
This creates a variable that is keeping the value 5 inside it. You can change the value as needed.
my_number = 5
print(my_number)
my_number = 10
print(my_number)
Variables can hold different types of information. The above example is using numbers. But you can do the same with strings of text.
my_name = "Jerry"
print(my_name)
When you write programs, you will use variables to hold all your information. Then you'll use programming commands to do things with that information.
All computer programs are filled with various commands that interact with variables. Like a LEGO set, you can put all those things together and create a program that does something interesting or useful.
+ 1
Thanks man