Posts in 2021

  • 10-06 Graph

    Wednesday, October 06, 2021 in Daily

    Default Dictionary Sometimes you want to have a “default value” in a dictionary. The default value is returned whenever you ask for the value of a key that is not in the dictionary. A typical use would be counting words, where the count …

    Read more

  • 09-30

    Friday, October 01, 2021 in Daily

    Examples are important. Work at an appropriate level. Debugging is important. Observations In my opinion, problem solving in computer science comes through working examples. Slow down enough to make examples and think through your program to make …

    Read more

  • 09-29

    Wednesday, September 29, 2021 in Daily

    Opener: Bucket Brigade bucket brigade You absolutely have the skills to do this problem. Do some examples and find out how it works! Portfolio Using good Pythonic code, solve all three problems in some level of the 2019 US Open. Contents of a …

    Read more

  • 09-28

    Tuesday, September 28, 2021 in Daily

    Reading: classes in Python. An introduction to object-oriented programming in Python. Section 9.2 is esoteric, you should skip it on the first reading. Section 9.3 is important. Translate into Python: Candy class Translate into Python: Animals: …

    Read more

  • 09-23

    Thursday, September 23, 2021 in Daily

    Upcoming Next week: Object oriented programming in Python. Tomorrow: Quiz on Python. Soon: searching and backtracking Week 6: graph theory. Skill of the day Python’s f-strings give a quick and easy way to create a string. Example: predator = …

    Read more

  • 09-21

    Friday, September 17, 2021 in Daily

    Reading You need to convert strings to numbers with the int function. Read a single number: int(input()) Read a list of numbers: [int(n) for n in input().split()] If different items in the list have different meanings, it can be useful to give them …

    Read more

  • 09-17

    Friday, September 17, 2021 in Daily

    (overlap) Given two lists of numbers, produce a sorted list of elements common to both of them. overlap [10, 20, 17, 30, 15, 18] [18, 30, 5, 17, 21, 90] == [17, 18, 30] Turn the following table into a dictionary called q2: Combo Effectiveness …

    Read more

  • 09-15

    Wednesday, September 15, 2021 in Daily

    Quiz Homework: USACO 2019 January Bronze 2: sleepy sorting

    Read more

  • 09-14

    Friday, September 10, 2021 in Daily

    Ongoing topics Print vs return Mutation functions do not return values. Also: Why does append return None? Examples: append, extend. The Python boss post on the topic is short and informative. Copy vs in-place: sorted(data) vs data.sort(). Upcoming …

    Read more

  • 09-10

    Friday, September 10, 2021 in Daily

    A list of the first 20 Fibonacci numbers. So $[1,1,2,3,5,\ldots]$. A list with the partial sums of the first 20 perfect fourth powers. So $[1^4, 1^4+2^4, 1^4+2^4+3^4, …]$. Write a function some_words that takes in a list of strings someWords …

    Read more