0% found this document useful (0 votes)
50 views

Python 10 Notes

Tuples are immutable like lists but use parentheses instead of brackets. They can contain mixed data types and values can be accessed through slicing or individual assignment like lists. Dictionaries are sequences indexed by keys of any hashable type like strings or numbers within curly brackets, without maintaining order of entry like lists. File names should be enclosed in quotes when opening a file.

Uploaded by

Tony Kurian
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
50 views

Python 10 Notes

Tuples are immutable like lists but use parentheses instead of brackets. They can contain mixed data types and values can be accessed through slicing or individual assignment like lists. Dictionaries are sequences indexed by keys of any hashable type like strings or numbers within curly brackets, without maintaining order of entry like lists. File names should be enclosed in quotes when opening a file.

Uploaded by

Tony Kurian
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

chapter 10 notes

tuple, they are exactly like list but they are not mutable. the syntax is (",") .
it can contain both string and int. when i pass a string to a tuple, it splits each
alpha in to a different variable. slizing is exactly like you do in list. when ther
are two tuples which are idendical, it cannot compare the difference between them
if the only difference is between string and int. decorate, sort and undecorate.
idea is that, if i have
tuple assignment.
we defined three things and put an equal sign. in this way we assign corresponding
values to corresponding variables.
i can use these variable individually as well. we can swap the values.
intro dictionary. it is also sequence but in the case of dictionary the index is a
key. key can be a number, or a string or anything we call hashable. hashab.e means
value that can be used to generate a hash key. dictionary is created using flower
bracket. dictionary will not maintain the oder in which we enter the keys and
values.
while trying to topen a file, the file name should always be put in quotes.

You might also like