variables in python | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 6

variables in python

why variables don't have data type?

25th Feb 2018, 11:13 AM
Shivani Goyal
40 Answers
+ 31
they are automatically assigned, it's just how python is made, simple elegant and only requires minimum amount of code, rest Python does for you :)
11th Mar 2018, 3:37 PM
Khushal Sahni
Khushal Sahni - avatar
+ 20
This is not just in Python. The same is done in VBA for variables by default, in JavaScript, and earlier it was in DBase and its descendants: FoxBase, FoxPro, Clipper.
25th Feb 2018, 12:42 PM
Вадим Сухотин (Vadim Sukhotin)
Вадим Сухотин (Vadim Sukhotin) - avatar
+ 14
they do kinda you just don't have to pre define the data type for the variable
25th Feb 2018, 11:53 AM
Obbu - avatar
+ 6
The variables data type are determined by their value assigned. This way a variable is flexible in its use, such as where an integer may be useful here then a float may be useful there.
24th Apr 2021, 5:31 PM
David Egelhoff
+ 2
It can't show the variable i've made
26th May 2020, 3:28 PM
Andrew Kendrick
Andrew Kendrick - avatar
+ 1
Once an object is assigned to a variable, you can refer to the object by that name. Ex:x=4 here,x is the variable name that assigned to 4.we can refer variable to get the value assigned to it.
29th Oct 2021, 4:45 PM
akkina niharika
+ 1
My fist comment
22nd Nov 2022, 5:29 AM
Egor Marder
Egor Marder - avatar
+ 1
Every variable in Python is considered as an object. Variables in Python follow the standard nomenclature of an alphanumeric name beginning in a letter or underscore. Based on the data type of a variable, the interpreter allocates memory and decides what can be stored in the reserved memory. You do not need to declare variables before using them, or declare their type. Variable names are case sensitive . Most variables in Python are local in scope to their own function or class. Global variables , however, can be declared with the global keyword.
22nd Nov 2022, 8:34 AM
Joseph Chukwudiegwu
Joseph Chukwudiegwu - avatar
Python is best I't dont like any language
3rd Apr 2021, 5:36 AM
amirali Bakhshandeh
amirali Bakhshandeh - avatar
Becasuse we asaign a value to a variable and we decide what type of value we give to it
4th May 2021, 3:52 PM
Pusthakala Divya
Pusthakala Divya - avatar
Nasıl yok var
11th May 2021, 11:54 AM
Berkay Biçer
Berkay Biçer - avatar
Only when you declare the values, the variables can be classified
15th May 2021, 7:05 PM
APOORVA M - avatar
Python is a dynamic language
17th Aug 2021, 11:35 PM
Cornelio Llagas
Cornelio Llagas - avatar
Depends on the values assigned to the variables
4th Sep 2021, 1:25 PM
John Sam George
Bcuz they change their data types according to the output value
17th Sep 2021, 7:10 PM
Sonam Bharti
Sonam Bharti - avatar
Python are lots of built in libraries and packages
26th Sep 2021, 6:50 AM
Cornelio Llagas
Cornelio Llagas - avatar
They have a data type dependent on what you initialize them to be
11th Oct 2021, 4:39 PM
Adesewa Adesida
Adesewa Adesida - avatar
Python is a programming language. 💯
21st Oct 2021, 10:07 AM
Shubham Bhatia
Shubham Bhatia - avatar
Because Python automatically understands the data type when you assign a value to it and there's no need to determine whether the data type is integer or float or string. For example: A = 7 #No need to write int A B = 7.5 #No need to write float B C = "Hi" #No need to write string C
28th Oct 2021, 2:26 PM
Majid Fatahian
Majid Fatahian - avatar
Variables generally have a data type when they are a assigned to a certain value. The data type of variable can be found by the type of value assigning to it. eg:-We calls different variables as numeric variables as they are assigned to numeric value.(n=5.1 , n is a numeric variable as the float value is assigned to it).
2nd Nov 2021, 4:30 PM
Nalluri Sai Kiran
Nalluri Sai Kiran - avatar