Размер видео: 1280 X 720853 X 480640 X 360
Показать панель управления
Автовоспроизведение
Автоповтор
So basically if you want a particular array which you don't want to change overtime then, it is recommended to use Tuple ( as it takes less memory ).Tuples: 1. Index 2. Count List:1.append2.removeetc..
8:07Sir flexing like a boss!😎😎😎😎😎
analogy: 1:57 2:55 3:25 [], {}, (): 4:22 5:00list methods vs tuple lists (inbuilt): 5:16(11) 5:45(2)access but cannot add: 6:05tuple is unchangeable: 6:20 (immutable) 16:15list can be changed: 6:29 (mutable)why?: 9:08 9:33 10:05 10:55 11:15 hidden benefit of tuple: 17:25s.__sizeof__(): 17:46summary: 18:57 (use tuple when have huge data and remains to be unchanged)list vs set vs tuple:import strings = string.ascii_lettersl = list(s)ss = set(s)t = tuple(s)print(s)print('as list {}'.format(l))print('as set {}'.format(ss))print('as tuple {}'.format(t))Output: (set is unordered and random)abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZas list ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']as set {'Q', 'e', 'x', 'V', 'X', 'Y', 'T', 'E', 'f', 'u', 'R', 'y', 'k', 'S', 'L', 'U', 'v', 'q', 'z', 'c', 'i', 't', 's', 'H', 'K', 'B', 'M', 'a', 'r', 'd', 'D', 'b', 'l', 'C', 'W', 'F', 'w', 'j', 'g', 'I', 'A', 'h', 'J', 'o', 'G', 'P', 'Z', 'p', 'N', 'm', 'n', 'O'}as tuple ('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z')
How do you get all functions of a data type listed out as sir did at 5:12? Is there some specific key combination that one needs to press?
Tab twice
थैंक्यू
11:40 we dont need to convert it to list first. tuple(s) also works!
Not sure I understood. In that min we only explain how we can convert tuples to list.
@@sudarshaniyengar8549 i mean we dont need to do tuple(list(s))tuple(s) also works!Oh my bad, the timestamp should be 11:34
@@sayanghosh6996 yes right. Good observation. 👍
So basically if you want a particular array which you don't want to change overtime then, it is recommended to use Tuple ( as it takes less memory ).
Tuples:
1. Index
2. Count
List:
1.append
2.remove
etc..
8:07
Sir flexing like a boss!
😎😎😎😎😎
analogy: 1:57 2:55 3:25
[], {}, (): 4:22 5:00
list methods vs tuple lists (inbuilt): 5:16(11) 5:45(2)
access but cannot add: 6:05
tuple is unchangeable: 6:20 (immutable) 16:15
list can be changed: 6:29 (mutable)
why?: 9:08 9:33 10:05 10:55 11:15
hidden benefit of tuple: 17:25
s.__sizeof__(): 17:46
summary: 18:57 (use tuple when have huge data and remains to be unchanged)
list vs set vs tuple:
import string
s = string.ascii_letters
l = list(s)
ss = set(s)
t = tuple(s)
print(s)
print('as list {}'.format(l))
print('as set {}'.format(ss))
print('as tuple {}'.format(t))
Output: (set is unordered and random)
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
as list ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']
as set {'Q', 'e', 'x', 'V', 'X', 'Y', 'T', 'E', 'f', 'u', 'R', 'y', 'k', 'S', 'L', 'U', 'v', 'q', 'z', 'c', 'i', 't', 's', 'H', 'K', 'B', 'M', 'a', 'r', 'd', 'D', 'b', 'l', 'C', 'W', 'F', 'w', 'j', 'g', 'I', 'A', 'h', 'J', 'o', 'G', 'P', 'Z', 'p', 'N', 'm', 'n', 'O'}
as tuple ('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z')
How do you get all functions of a data type listed out as sir did at 5:12? Is there some specific key combination that one needs to press?
Tab twice
थैंक्यू
11:40 we dont need to convert it to list first. tuple(s) also works!
Not sure I understood. In that min we only explain how we can convert tuples to list.
@@sudarshaniyengar8549 i mean we dont need to do tuple(list(s))
tuple(s) also works!
Oh my bad, the timestamp should be 11:34
@@sayanghosh6996 yes right. Good observation. 👍