Skip to content

Instantly share code, notes, and snippets.

@jwoglom
Created January 27, 2020 21:11
Show Gist options
  • Save jwoglom/2079a615509413c9d198f9d485709fe0 to your computer and use it in GitHub Desktop.
Save jwoglom/2079a615509413c9d198f9d485709fe0 to your computer and use it in GitHub Desktop.
CS365 Python Intro Session
def numbers_sum_to_ten(num1, num2):
"""
Return True if num1 and num2 sum to 10.
Ex.: numbers_sum_to_ten(5, 5) => True
"""
pass
def word_count(search_word, sentences):
"""
Return the number of times a given word occurs in a group of sentences.
Make sure that you ignore any trailing periods between sentences.
Ex.: word_count("fox", "Red fox jumps by foxy blue fox. A fox said.") => 3
"""
pass
def words_starting_with(prefix, word_set):
"""
Return a set of words which start with prefix.
Ex.: word_count("fox", {"red", "fox", "firefox", "foxy"})
=> {"fox", "firefox"}
"""
pass
def multiples_of(number, count=5):
"""
Return a list of size count containing multiples of number.
Ex.: multiples_of(10) => [10, 20, 30, 40, 50]
Ex.: multiples_of(10, count=3) => [10, 20, 30]
Raise a ValueError if count is 0 or fewer.
"""
pass
""" OFFICE_HOURS denotes course staff which hold office hours for each day of
the week (Monday - Friday). In this example, James works 3 hours on Monday,
Wed., and Friday while Conor works 2 hours on Tues., Wed., and Thurs. """
OFFICE_HOURS = {"James": (3, 0, 3, 0, 3),
"Conor": (0, 2, 2, 2, 0),
"Arun": (2, 3, 0, 3, 2) }
DAYS = ("Monday", "Tuesday", "Wednesday", "Thursday", "Friday")
def office_hours_held(day_of_week):
"""
Return the names of course staff who are holding office hours on the given
day of the week (an integer where 0=Monday, 4=Friday) in a list.
Also return the integer number of total office hours available on that day
Ex.: office_hours_held(0) => (5, ["James", "Arun"])
"""
pass
def office_hours_format():
"""
Print a formatted string with each person's office hour durations on each day.
Ex.: "James: Monday (3 hrs), Wednesday (3 hrs), Friday (3 hrs)
Conor: Tuesday (2 hrs), Wednesday (2 hrs), Thursday (2 hrs)"
"""
pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment