List, Tuples, Dictionaries in Python | List, Tuples, Dictionaries Functions and methods in python | CBSE Class XII Computer science

List, Tuples, Dictionaries in Python 

Hi guys Let us Revise about List, Tuples, Dictionaries in Python 


Let us Revise  List, Tuples, Dictionaries in Python

  1. Python strings are stored in memory by storing individual characters in contiguous memory locations.
  2. The index (also called subscript sometimes) is the numbered position of a letter in the string.
  3. In Python, indices begin 0 onwards in the forward direction up to length-1 and -1, -2,... up to-length in the backward direction. This is called two-way indexing.
  4. The string slice refers to a part of the string s[start:end] is the element beginning at start and extending up to but not
  5. including end.
  6. Lists are mutable sequences of Python i.e., you can change elements of a list in place.
  7. Lists index their elements just like strings, i.e., two way indexing.
  8. Lists are similar to strings in many ways like indexing, slicing and accessing individual elements but they are different in the sense that Lists are mutable while strings are not. does the
  9. Membership operator in tells if an element is present in the sequence or not and not in opposite.
  10. List slice is an extracted part of a list; list slice is a list in itself.
  11. L[start:stop] creates a list slice out of list L with elements falling between indexes start and stop, not including stop. Tuples are immutable sequences of Python i.e., you cannot change elements of a tuple in place.
  12. To create a tuple, put a number of comma-separated expressions in round brackets. The empty round brackets i.e., ()
  13. indicate an empty tuple. Tuples index their elements just like strings or lists, i.e., two way indexing.
  14. Tuples are stored in memory exactly like strings, except that because some of their objects are larger than others, they store a reference at each index instead of single character as in strings.
  15. Tuple slice is an extracted part of tuple; tuple slice is a tuple in itself.
  16. T[start:stop] creates a tuple slice out of tuple T with elements falling between indexes start and stop, not including stop.
  17. Dictionaries are mutable with elements in the form of a key:value pair that associate keys to values.
  18. The keys of a dictionary must be of immutable types.
  19. In Python dictionaries, the elements (key:value pairs) are unordered; one cannot access element as per specific order.

Post a Comment

If you any doubts, Please let me know

Previous Post Next Post