indices

Wed W1

Announcements

  • Welcome to IDS-101-13: Thinking Machines!
  • It's other first week of class!
    • My SSN is 123 45 6789 (this is true) ssn = ['123', '45', '6789']
    • I should get someone to do this math for me. squares = [x * x for x in t]
    • What was that threeth (not third) thing you said again. ssn[3]
    • That one throws an error. What was the oneth (not first) thing I said? print(ssn[1])
    • It was 45
    • Why no quotes?

WHY NO QUOTES

  • Surely we can acknowledge this is worth thinking about in the future right.
Group 1Group 2Group 3Group 4

Question #1

What is the smallest number of apples someone can have?
  • Think about a possible answer on your own
  • Discuss your answers with the rest of the group
  • Record a summary of each group’s discussion

Question #2

What is the smallest number of which a machine can think?
  • Think about a possible answer on your own
  • Discuss your answers with the rest of the group
  • Record a summary of each group’s discussion

Question #3

What is the largest number of which a machine can think?
  • Think about a possible answer on your own
  • Discuss your answers with the rest of the group
  • Record a summary of each group’s discussion

Python

  • Recall we have thematically introduced annoyance to resolve in latter lectures.
  • Exercise A.8 Write a function prints the final element of a list.
    • Consider the following: conts = ['Africa', 'Americas', 'Antarctica', 'Eurasia', 'Oceania'] print(conts[1])
    • What does the 1 in this code do?
    • What happens if you change it to
      • Large values, like 400 or 400 ** 400?
      • Non-integer values, like 0.5?
      • Anything else?
    • I asked for small, large, and non-whole numbers.
    • What type of number did I leave out?

Question #4

How can we think critically about questions posed to us by our circumstances or by other thinkers?
  • Think about a possible answer on your own
  • Discuss your answers with the rest of the group
  • Record a summary of each group’s discussion

Strings

  • Python deals well with numbers, and, now we know, things that aren't numbers.
  • I don't know what a continent is and I'm afraid to ask at this point, but not a number.
  • When we have a ordered collection of letters...
    • They aren't words but the aren't not words either.
  • We call that a string.
  • It is ordered, so 'abc' is not the same as 'cba' 'abc' != 'cba'
    • What does '!=' mean?
  • Basically strings are like lists. 'abc'[1] == ['a', 'b', 'c'][1]
  • But can only hold 'characters' - basically the symbols we can type.

Python

  • Recall we have thematically introduced annoyance to resolve in latter lectures.
  • Exercise A.9 Determine how indices of lists and strings work.
    • Consider the following: str = 'abcdefghijklmnopqrstuvwxyz' print(strs[4:20:7])
    • What does the 4 in this code do?
    • What does the 20 in this code do?
    • What does the 7 in this code do?
    • What happens if you remove one of the three? Remove two?
    • In triple_check, we found some arrangements of three numbers sometimes have a nice property.
      • Say, for triple_check to return True, 'c' needed to be larger than 'a' and 'b'

Homework

  • Homework 2 Order of Operations
    • There is this arithmetic concept called "order of operations" sometimes called PEMDAS:
      • Parenthesis
      • Exponentiation
      • Multiplication/Division
      • Addition/Subtraction
    • Conduct a series of tests to determine whether Python follows PEMDAS rules or not.
    • You may make a copy of this Notebook and share it with me and anyone with whom you collaborate.
      • Give Shouvik and I edit permissions.
      • Due Fri @ 12 Noon (so we're able to discuss it in class)
      • You may only give your peers view or comment permissions.
  • Homework 3 Electoral Votes