Skip to main content
  1. /classes/
  2. Classes, Spring 2024/
  3. CS 2370 Spring 2024: Course Site/

cs2370 Notes: 07 More Lists

·116 words·1 min·

Designing a function:
#

  • Purpose statement
  • Signature (e.g. int -> int)
  • Examples
  • Stub
  • Standard pattern
  • Write the body
  • Asserts

Simple Design with Lists
#

  • Given a list of integers and an integer, determine how many times the integer appears in the list.
  • Given a list of integers, produce a list showing the number of times the list in that position in the input appears in the input. Example: [4,4,4,1,1] -> [3,3,3,2,2]
  • Finding prime numbers.

Tuples
#

A sheep is a pair (name, color). Write a function that counts the pink sheep in a list.

Pyglet
#

From the hw03 starter code, using the Pyglet docs, write a program in which a circle bounces around the window.

Nat Tuck
Author
Nat Tuck