Homework 0#

General assignment information

One-time setup#

Please do the following:

Tutorials#

  1. Watch Crash Course Computer Science: Statements & Functions

  2. Do Learn Python’s Learn the Basics. You can skip the chapters on:

    • Functions

    • Classes and Objects

    • Modules and Packages

  3. Read about:

It’s important that you have a good understanding of these fundamentals - otherwise, the rest of the course will be hard to follow. If you’re feeling lost / find the rest of this assignment challenging, try going through the corresponding topics in one of the Python resources in the next week or so.

Coding#

Getting input#

To get information from a user, we can use Python’s input() function. Run this cell and try it out:

word = input("Give me a word: ")
word

input() box not (always) showing up? See common issues.

Step 0: Mad lib#

You are going to make a (short) interactive mad lib. Use a paragraph of a story or the chorus from a song, or make one up. Prompt for each of the words (“noun”, “verb”, “vehicle”, etc.), then once they are all entered, it output the mad lib with the provided words filled in. You will be using multiple inputs() and string concatentation.

# your code here

Numeric input#

input() always returns a string. To get a number from a user in Python, you need to convert that input into a integer (or float). Run these cells in order to try it out:

num = input(
    "Pick a number, any number. Please enter the value without commas or decimals. > "
)
num
type(num)
int(num)

Step 1: Unemployment benefit eligibility assessment#

We will now make an interactive tool to assess people for unemployment benefits. We will use a simplified set of rules. To be elegible, one must:

  • Have lost employment

  • Have made at least $10,000 in the past year

    • Ask for their salary rather than as a yes-or-no question

  • Be ready, willing and able to work immediately

  • Be actively seeking work

The program should then print "You are eligible" or "You are not eligible". You will need:

  • input()s

  • int()

  • Conditional(s)

# your code here

Now turn in the assignment.

Tutorials, Continued#

Kaggle is a data science platform that has various tutorials and competitions, which you may want to go back to later. You are welcome to create a Kaggle account to save your progress, but it’s not required.

Kaggle, like JupyterHub, is built around Jupyter notebooks. They are not exactly the same, but will feel similar. Do the following Kaggle tutorial. You do not need to turn this in.

Participation#

Reminder about the between-class participation requirement.