+ 14
What is variable name in Python?
What is the logic behind it and how they use?
65 Respostas
+ 17
A Variable is something like a box, so u can save data in it.
For example: u have a 5 an u want save it u can do this for example with x = 5.
x has now the value 5
+ 13
It's a bucket, whenever you write "x= 42"
42 is a integer which is 4 bytes
The = tells the system you want to reserve memory.
The varible name x is basically to point where in memory your 4 bytes of memory is saved.
+ 5
Variables are the names which we use for storing something
+ 4
Can you tell me what is the other things like? ArtCraft please
+ 4
A variable is storage location box where the value is placed for the use in our program
e.g:if we given a value for the variable i.e, r = 4
Here the value is placed in the ' r ' variable for use in our program
+ 4
A variable name must start with a letter or the underscore character.
It cannot start with a number.
It can only contain alpha-numeric characters and underscores (A-z, 0-9, and _ ).
Eg:
Total_mark= 450
A= 25
+ 3
Value of x will change like you said the value of x is 5
Eg x=5
Print(x)
Print (x+5)
>>>5
>>>10
That is variable correct ArtCraft ?
+ 3
I use python for a writing a code
+ 3
Variable is used to store some values.
Example
x=2
y=5/6
+ 3
A variable name is sort of id that identifies a variable, that can be later used in the program, but only in the scope that it's defined
The more general term is identifier, which includes variables, functions, classes and modules, because all of them have an identifer that identifies them as different from the rest of the objects
Also, you must assign a value to variable, always remember it
It will always be from the following form (according to python's official docs):
[identifier ":="] expression
That means you put a variable name, and then = sign, and then expression you assign to the variable name
+ 3
Variable is an Container which you can assign varying degrees of data types into
+ 2
Well it's better when i explain it with an example:
U can have diffrent datatypes like Strings ("abc"...) or Integer (1,2,3...) or Floats(1.0,2.5......)
In Python u don't have to declare the Type of a Variable, u can simple write x=5 and x ist automaticially an Integer.
What u can for example do with an String is:
a = "Hello"
b = "World"
c = a+b
print(c)
>>> 'Hello World'
You can a Variable also use as an interator for a Loop
like:
a = 0
for i in range(0,10):
a = a+1
print(a)
+ 2
Are u an Beginner in programming or just in Python?
+ 2
I think variable of python talk about assigning name
Example if a= 3
And b=2
Print(a+b)
Output= 5
+ 1
Yeah that is What u can do with variables, but u can do a lot of other things with variables
+ 1
No problem :)
If u have questions u can write me a pm and i try to help u :)
And please excuse my bad English XD
My favourite languages are Python and Java :)
+ 1
Which IDE do u use?
+ 1
Sorry I don't know what is IDE?
+ 1
Variable is like container. You can store values/data in it
Suppose you want to add number which is taken as an input from user. So you can use variable to store the values which is taken from user.
Example: x= int(input())
y = int(input())
z = x+y
print(z)