GoConqr hat ein neues Design! Sag uns, wie es dir gefällt.

Karteikarten

Flash Cards -List & Dictionary

Aparna Dhirde Englisch 33 Karten

Karten in diesem Stapel (33)

  1. 1Listlist is an ordered sequence which is mutable and made up of one or more elements.
  2. 2Lists are MutableIt means that the contents
    of the list can be changed after it has been created.
  3. 3List OperationsConcatenation,Repetition,Membership,
    Slicing
  4. 4range(n)returns a sequence of numbers
    starting from 0, increases by 1 and ends
    at n-1 (one number less than the specified
    number i.e. is)
  5. 5Built-in Functionsfunctions are defined as the functions whose functionality is pre-defined in Python.
  6. 6len()Returns the length of the list passed as
    the argument
  7. 7list()Creates an empty list if no argument is
    passed
    Creates a list if a sequence is passed as
    an argument
  8. 8append()Appends a single element passed as an
    argument at the end of the list
    A list can also be appended as an element
    to an existing list
  9. 9extend()Appends each element of the list passed
    as argument at the end of the given list
  10. 10insert()Inserts an element at a particular index
    in the list
  11. 11count()Returns the number of times a given
    element appears in the list
  12. 12find()Returns index of the first occurrence of
    the element in the list. If the element is
    not present, ValueError is generated
  13. 13remove()Removes the given element from the
    list. If the element is present multiple
    times, only the first occurrence is
    removed. If the element is not present,
    then ValueError is generated
  14. 14pop()Returns the element whose index is
    passed as argument to this function
    and also removes it from the list. If no
    argument is given, then it returns and
    removes the last element of the list
  15. 15reverse()Reverses the order of elements in the
    given list
  16. 16sort()Sorts the elements of the given list in
    place
  17. 17sorted()It takes a list as parameter and creates
    a new list consisting of the same elements
    but arranged in ascending order
  18. 18min()Returns minimum or smallest element
    of the list
  19. 19max()Returns maximum or largest element of
    the list
  20. 20sum()Returns sum of the elements of the list
  21. 21DictionariesThe data type dictionary falls under mapping. It is a mapping between a set of keys and a set of values. The key-value pair is called an item. A key is separated from its value by a colon(:) and consecutive items are separated
    by commas. Items in dictionaries are unordered
  22. 22Creating a DictionaryTo create a dictionary, the items entered are separated by commas and enclosed in curly braces. Each item is a key value pair, separated through colon (:). The keys in the dictionary must be unique and should be of any immutable data type i.e. number, string or tuple. The
    values can be repeated and can be of any data type.
  23. 23Membership OperationThe membership operator in checks if the key is present in the dictionary and returns True, else it returns False.
  24. 24Dictionaries are Mutablewhich implies that the
    contents of the dictionary can be changed after it has been created.
  25. 25Built in functions len()Returns the length or number of
    key: value pairs of the dictionary
    passed as the argument
  26. 26dict()Creates a dictionary from a
    sequence of key-value pairs
  27. 27keys()Returns a list of keys in the
    dictionary
  28. 28values()Returns a list of values in the
    dictionary
  29. 29items()Returns a list of tuples
    (key —value) pair
  30. 30get()Returns the value corresponding
    to the key passed as the argument
    If the key is not present in the
    dictionary it will return None
  31. 31update()appends the key-value pair of
    the dictionary passed as the
    argument to the key-value pair of
    the given dictionary
  32. 32clear()Deletes or clear all the items of
    the dictionary
  33. 33del()Deletes the item with the given
    key .To delete the dictionary from the
    memory we write:
    del Dict_name

Informationen

Beschreibung
Karteikarten am Flash Cards -List & Dictionary, erstellt von Aparna Dhirde am 17/03/2020.
Erstellt von
Aparna Dhirde
Aufrufe
9
Bewertung

Feedback

Worum geht es?

Wie gefällt dir das neue Design?

Dein Eindruck