GoConqr has a new look! Let us know what you think.

Flashcards

SCC212 - Python things

Mac Howarth English 15 cards

Cards in this deck (15)

  1. 1Python tings coming upg
  2. 2The range function can accept three parameters e.g. range(x, y, z) what does each represent respectivelyx = start: Starting number of the sequence.
    y = stop: Generate numbers up to, but not including this number.
    z = step: Difference between each number in the sequence.
  3. 3What does filter() do?filter(function, sequence) returns a list consisting of those
    items from the sequence for which function(item) is true.
  4. 4What does map() do?map(function, sequence) calls the function for each item in
    the sequence and returns a list of the resulting values.
  5. 5What does reduce() do?reduce(function, sequence) returns a single value from a sequence of values
  6. 6TupleTuple = ('red', 'green')
    can access like array
    tuple[1]
    Immutable
  7. 7Nested sequencesscores =[(“Lynn”,759),(“John”,678), (“Chris”,798), (“Mary”,800)]
    Tuples inside of lists
  8. 8Dictionariesmutable
    Can store any number of objects, including list/tuples
    dict1 = { 'abc': 123, 98.6: 37 }
    Key is separated from it's value with a colon
    Keys are unique
  9. 9String indexinguse -number to index backwards
    s[-2]
    the actual number to index forwards
  10. 10SlicingWay to extract entire section in a single step
    s[1:3]
    Slice of s from offsets 1 through 2 (not 3)
    s[1:]
    Everything past the first (1:len(s))
  11. 11StringsImmutable
    every string operation is defined to produce a new string as its results
  12. 12Listsl = [item1, item2, item3]
    no fixed size, no fixed data type
  13. 13Lists comprehensionM = [ [1,2,3],
    [4,5,6],
    [7,8,9] ]
  14. 14Simple exception handlingtry:
    except:
  15. 15Lambdalambda x, y, z: x + y + z
    lambda argument, argument2, argumentn: expression
    using arguments

Information

Description
Flashcards on SCC212 - Python things, created by Mac Howarth on 15/05/2017.
Created by
Mac Howarth
Views
4
Rating

Feedback

What is it about?

What do you think of the new look?

How do you like it?