What is variable name in Python? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 14

What is variable name in Python?

What is the logic behind it and how they use?

28th Feb 2019, 3:48 PM
Bhavin Parmar
Bhavin Parmar - avatar
65 Answers
+ 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
1st Mar 2019, 9:26 AM
Sebastian
Sebastian - avatar
+ 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.
5th Apr 2021, 10:51 PM
DARC
DARC - avatar
+ 6
Now I understood. Yeah I am beginner in programming, before that i don't learn any language, python is first one. Tysm ArtCraft 🙆
2nd Mar 2019, 4:26 PM
Bhavin Parmar
Bhavin Parmar - avatar
+ 5
Variables are the names which we use for storing something
29th Sep 2021, 12:46 PM
Rishav Kumar
Rishav Kumar - avatar
+ 4
Can you tell me what is the other things like? ArtCraft please
2nd Mar 2019, 4:24 AM
Bhavin Parmar
Bhavin Parmar - avatar
+ 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
22nd Sep 2021, 1:11 PM
B RANADEER
B RANADEER - avatar
+ 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
24th Sep 2021, 5:26 AM
Krïśh Ĺövė
+ 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 ?
1st Mar 2019, 2:08 PM
Bhavin Parmar
Bhavin Parmar - avatar
+ 3
I use python for a writing a code
2nd Mar 2019, 5:20 PM
Bhavin Parmar
Bhavin Parmar - avatar
+ 3
Variable is used to store some values. Example x=2 y=5/6
6th Apr 2021, 6:31 AM
ADITYA KUMAR
+ 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
18th Dec 2021, 8:35 PM
‎ליאור ו‎
‎ליאור ו‎ - avatar
+ 3
Variable is an Container which you can assign varying degrees of data types into
26th May 2022, 1:23 PM
Amir Almasy
Amir Almasy - avatar
+ 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)
2nd Mar 2019, 3:19 PM
Sebastian
Sebastian - avatar
+ 2
Are u an Beginner in programming or just in Python?
2nd Mar 2019, 3:20 PM
Sebastian
Sebastian - avatar
+ 2
I think variable of python talk about assigning name Example if a= 3 And b=2 Print(a+b) Output= 5
18th Jun 2022, 9:06 PM
Senetsedal Tesfaye Waktola
Senetsedal Tesfaye Waktola - avatar
+ 1
Yeah that is What u can do with variables, but u can do a lot of other things with variables
1st Mar 2019, 6:11 PM
Sebastian
Sebastian - avatar
+ 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 :)
2nd Mar 2019, 5:03 PM
Sebastian
Sebastian - avatar
+ 1
Which IDE do u use?
2nd Mar 2019, 5:05 PM
Sebastian
Sebastian - avatar
+ 1
Sorry I don't know what is IDE?
2nd Mar 2019, 5:08 PM
Bhavin Parmar
Bhavin Parmar - avatar
+ 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)
18th May 2022, 10:37 AM
Jyoti Gupta