Type of list | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Type of list

Why when write a=[20] is type work normaly, but when we write a=list[20] is output - "object is not subscriptale?

5th May 2020, 7:32 PM
Dmitriy Knni
Dmitriy Knni - avatar
4 Answers
+ 3
Try a = list(20)
6th May 2020, 1:25 AM
David Ashton
David Ashton - avatar
+ 1
When write a=list(20) is output - " 'int' object is not iterable
6th May 2020, 2:35 PM
Dmitriy Knni
Dmitriy Knni - avatar
0
print(type(list('20')))
6th May 2020, 4:11 PM
Yurii Ostapenko
Yurii Ostapenko - avatar
- 1
Ok, but why a=list[20] not work?
26th May 2020, 4:18 PM
Dmitriy Knni
Dmitriy Knni - avatar