# ccc/1.01-python-iteration_control_functions-lesson

No description, website, or topics provided.
Switch branches/tags
Nothing to show
Latest commit e50c87f Jan 12, 2018
Type Name Latest commit message Commit time
Failed to load latest commit information.
datasets Mar 1, 2017
solution-code Jan 12, 2018
.gitignore Apr 10, 2017
CHANGELOG.md Dec 21, 2017
iteration-control-flows-functions.ipynb Jan 12, 2018

# Review python iteration, control flows, and functions

Unit 1, Lesson 4

## Materials We Provide

Lesson Jupyter Notebook with instructions and empty cells for codealong Link
Solutions Sample solutions to codealong Link

Dataset description: Small, unclean dataset of individuals' numbers of orders from different coffee shops. Used for control flow practice.

## Learning Objectives

• Explore `Python` control flow and conditional programming.
• Implement `For` and `While` loops to iterate through data structures.
• Apply `if, else` conditional statements.
• Create functions to perform repetitive actions.
• Demonstrate error-handling using `try, except` statements.
• Combine control flow and conditional statements to solve the classic "FizzBuzz" code challenge.
• Use `Python` control flow and functions to help us parse, clean, edit and analyze the Coffee Preferences dataset.

## Student Requirements

Before this lesson(s), students should already be able to:

• Know python data types: string, int, float, boolean, tuple, list, dictionary

## Lesson Outline

• If Else Statement
• Write an if-else statement to check whether the suitcase is over 50lb.
• Write an if-else statement for multiple conditions.
• Iterating With For Loops
• Write a for-loop that iterates from the number 1 to the number 15.
• Iterate from 1 to 15, printing whether the number is odd or even.
• Iterate from 1 to 30 with the various instructions.
• Iterate through a list of animals, and print each one in all caps.
• Iterate through the animals list. Capitalize the first letter and append the modified animals to a new list.
• Iterate through the animals. Print out the animal name and the number of vowels in the name.
• Functions
• Write a function that takes word as an argument and returns the number of vowels in the word.
• Write a function to calculate the area of a triangle using its height and width.
• While Loops
• While loops and strings
• Try to convert elements in a list to floats
• Practice control flow on Coffee Preference dataset
• Load coffee preference data from file and print
• Remove the remaining newline `'\n'` characters with a for-loop
• Split the lines into "header" and "data" variables.
• Split the header and the data strings on commas.
• Remove the "Timestamp" column.
• Convert numeric columns to floats and empty fields to `None`.
• Count the `None` values per person, and put counts in a dictionary.
• Calculate average rating per coffee brand.
• Create a list containing only the people's names.
• Picking a name at random. What are the odds of choosing the same name three times in a row?
• Construct a while loop to run the choosing function until it returns True.