Python MCQ 81 - Test Your Skills
Автор: SS IT Lectures Tamil தமிழ்
Загружено: 2025-11-07
Просмотров: 88
Описание:
#python
#pythonprogramming
Python MCQ Questions and answers,
Python MCQ , Python Programming,
Python, Python Sequence, Python Iterable,
Tuple, Sequence,
Extended Iterable unpacking, Iterable unpacking,
Right-Hand Side Iterable Unpacking (Sequence Literal),
RHS Iterable Unpacking,
Iterable unpacking on the right-hand side (RHS),
Return tuple
Left-Hand Side Iterable Unpacking (Sequence Literal),
LHS Iterable Unpacking,
Iterable unpacking on the left-hand side (LHS),
Always return list
unpacks the iterable into items.
comma (,) after iterable makes the items as tuple literal,
list unpacking, string unpacking,
set unpacking, dictionary unpacking,
range unpacking,
Multiple assignment or parallel assignment,
Assigns a list of all items from iterable being unpacked
iterable: sequence, file objects, Generators
sequence:
lists, tuples, range, str, bytes, bytearray, memoryview.
Tuples⇒immutable sequences, typically used to store collections of heterogeneous data.
Actually comma makes a tuple, not parentheses (). The parentheses are optional, except in the empty tuple.
Tuple creation: using constructor tuple(), using iterable,
But tuple can store immutable sequences.
tuple packing,
NIELIT M3-R5 Course 'O' Level Certification,
PG TRB,
TN TRB Assistant Professor Computer Science,
TN TRB AP Computer Science,
TRB AP,
GATE - Data Analytics, GATE - DA,
UGC NET, TANCET MCA, TN SET,
#pythontutorial #pythonforbeginners #pythonlists
#pythonlist
#pythondeveloper #pythoncoding #learnpython
#pythonquiz #python3 #pythonskills #codingpython
#pythonbasics #pythonbeginner #pythonprogramming
#datascience #dataanalytics
#codingquiz #quizchallenge #codingcommunity
#freshers #techtalk #top10
#interviewpreparation #interviewhacks #interviewquestions #interviewskills
Ace your Python exams with this MCQ marathon!
Covers various Python concepts, including input/output, data structures, and more.
#PythonMCQs #PythonInterview #CodingQuiz #PythonProgramming #TechSkills
#ssitlecturestamil @ssitlecturestamilதமிழ்
RHS Iterable Unpacking
t = *itr,
→*itr unpacks the itr into items.
→comma (,) after itr makes
the items as tuple literal
→Returns tuple
→PEP 448
t = *itr,⇔t = (*itr, )
LHS Iterable Unpacking
*a, = itr
→Returns tuple
→PEP 3132
→Refer MCQ 78
Tuple Packing
→Refer MCQ 76
Different Iterable Unpacking
→Refer MCQs 77 to 81
x = 'Tom'
*y, = x
Unpacks x→'Tom'⇒'T', 'o', 'm'⇒['T', 'o', 'm']
z = *x,
Unpacks x→'Tom'⇒'T', 'o', 'm'⇒('T', 'o', 'm')
prints⇒['T', 'o', 'm'] ('T', 'o', 'm')
Extended Iterable Unpacking
a,*b,c=itr
a,c→mandatory expr
*b→starred expr(catch-all)
Assigns items to mandatory expr as per position
Assigns a list of all items not assigned to any mandatory expr
Starred expr
→At most one
→Only as assignment targets, (except star-args in function calls) else SyntaxError.
no. of itms in itr lesser than no.of mandatory expr
⇒ValueError: not enough values to unpack
starred expression (*) used during variable unpacking will always result in the remaining items being collected into a list data type, regardless of the original iterable's type.
the starred expression (*) used during variable unpacking will always result in the remaining items being collected into a list data type, regardless of the original iterable's type.
Basic sequence types:
lists, tuples, range.
Additional sequence types:
Text: str
Binary: bytes, bytearray, memoryview.
Mutability: Object's internal state is changeable.
Mutable sequences: Can be changed after creation.
lists, bytearrays
Immutable sequences: Cannot change once created.
tuples, strings, ranges, bytes
Повторяем попытку...
Доступные форматы для скачивания:
Скачать видео
-
Информация по загрузке: