0

python,lists

number = 3 things = ["string", 0, [1, 2, number], 4.56] print(things[1]) print(things[2]) print(things[2][2]) why "string" is used in this code?

17th Dec 2016, 6:50 PM
Nischay Soni
Nischay Soni - avatar
1 Respuesta
0
The list things is initialized with some example values and one of them is "string". This is intended to show that you can store different data types e.g. strings, numbers and even lists in the same list. The value "string" could also be "abc" - it is example code
17th Dec 2016, 9:28 PM
Florian Marwitz
Florian Marwitz - avatar