Codelab / 05 Introduction to Python

https://media.giphy.com/media/9xaryfkdWqqiK6QHKf/giphy.gif

Lesson

Lesson document

  1. Let’s get coding
  2. Python interactive interpreter
  3. Data structures
  4. Documentation
  5. Dogs

Resources

Python data types cheatsheet

Terms


Homework for Week 5

Coding Assignment 0: Simplified Pig Latin

Produce a simple program to accept a single word as text input and then print out the pig latin translation.

When I first assigned this homework, I didn’t actually know that Pig Latin is a more complicated and potentially more ambiguous algorithm than I thought! Because of this, we can implement the simplest case for the word provided: just shift the first letter to the end and add “ay” to it.

Taking into consideration words starting with consonant clusters or vowels requires some conditional logic, which we haven’t gone over yet, but feel free to jump ahead if you really want to show off.

Your code should be structured something like this:

word = input("Enter word: ")
# Pig latin code goes here
print(pig_latin)

Natural Language Coding

Once again, let’s write, in plain English, precise and detailed step-by-step instructions for a task: given a list of students, pair off each student with a partner, making sure to not double-book anyone and to not assign anyone to be their own partner. What kinds of “edge cases” (unexpected conditions) do we have to watch out for? What’s missing from these instructions?

Read:

Posner, Miriam (2015), Humanities Data, a Necessary Contradiction