Тёмный
No video :(

Python Data Structures #4: List Object 

Brian Faure
Подписаться 13 тыс.
Просмотров 7 тыс.
50% 1

Continuing our series of videos covering the most prevalent data structures you'll come across in Python. In this video, we'll begin by discussing the basics of the Python list object, and later, we'll head over to a coding editor to get a better idea of how to implement functions and algorithms using the list object.
If you're interested in Python GUI development check out my video series starting with: • Python GUI Development...

Опубликовано:

 

4 сен 2017

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 6   
@zulfiqarali1212
@zulfiqarali1212 6 лет назад
thanks alot.
@BrianFaure1
@BrianFaure1 7 лет назад
Two things... (1) The two instances of 'append' at 2:27 should actually be 'insert' (2) Another simple way to check if an item is in a list is by using the syntax "x in a" where 'x' is the element you wish to search for and 'a' is the list. This will return True or False, rather than the alternative .index() method shown in the video (which returns the index of the element). (3) At 4:43, valid indices range from (0, length of list -1), rather than (0, length of list). Passing length of list will result in an error because the last element of the list is at index length of list -1.
@TrippleMYouAlreadyKnow
@TrippleMYouAlreadyKnow 2 года назад
@ 10:20 there is an example for element in a: print a Which should be: for element in a: print element
@jingyuchang1885
@jingyuchang1885 6 лет назад
Hi Brian, thanks for the videos! I have a question about the underscore you used for the iteration. You said underscore doesn't save any values. Does that mean if you try to print underscore, you will get nothing? The program is like below: for _ in range(10): print(_) I tried this and still got 1-9 printed out. So can you explain how to use underscore and under what condition we should use it? I hope I expressed myself clear and can make you understand me! Forgive my bad English! Thank you a lot!
@BrianFaure1
@BrianFaure1 6 лет назад
Hi Jingyu, it's actually more of a convention to use underscore for temporary or private values rather than something that's actually coded into Python. I had never tested it out so I assumed variables saved to underscores wouldn't be accessible but as you have shown it turns out they are! Thanks again for the comment!
@jingyuchang1885
@jingyuchang1885 6 лет назад
Brian Faure Thanks for your response! Really appreciate it!
Далее