What is the default data type of items in list? Are they considered to be characters, integers, or somethings else? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is the default data type of items in list? Are they considered to be characters, integers, or somethings else?

how does the items of a list are treated as a data type. as we can see the operations over two elements like for example a= [5,2,3,4,7]. a[0]+a[1]=7. so does elements are considered to be integers? if b=["hi", "hello", "how"], b[0]+b[2]=hihow. so how does items of a list are treated?

17th Jan 2018, 1:51 PM
S Aditya Gautam
S Aditya Gautam - avatar
1 Answer
0
there is nothing like default data type of items when you write a whole number, for example 3, it is an integer (int), when you put something in quotation marks, it will be a string "spam" when you write 3.7 or 8.0, it will be float every element in list can have its own type
17th Jan 2018, 6:14 PM
michal