Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
YStrano
GitHub Repository: YStrano/DataScience_GA
Path: blob/master/lessons/lesson_02/code/python-foundations/README.md
1904 views

Python Foundations

Unit 1: Required


Materials We Provide

TopicDescriptionLink
Lesson(Beginner) Part 1: Data TypesPart One
Lesson(Intermediate) Part 2: Control FlowPart Two
PracticePractice: Part 1: Data Typeshere
Practice: Part 2: Functionshere
(Intermediate, Bonus) Practice: IMDB Intro Labhere
SolutionsSample Solutions for Blanked Out Lesson DemoData Types
Sample Solutions: Part 1, PracticePractice: Data Types
Sample Solutions: Part 2, PracticePractice: Functions
Sample Solutions: Bonus LabIMDB Lab
Source MaterialsOriginal files used to create this lessonHere

Learning Objectives

By the end of this lesson, students will be able to:

Part 1: Python Data Types

  • Discuss Python as a programming language.

  • Define integers, strings, tuples, lists, and dictionaries.

  • Demonstrate arithmetic operations and string operations.

  • Demonstrate variable assignment.

Part 2: Python Iteration, Control Flows, and Functions

  • Define 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.

  • Use Python control flow and functions to help us parse, clean, edit and analyze data sets.


Student Requirements

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

  • Recall and define common Python data types.


Lesson Outline

Instructor Note: This material may be challenging to get through if students are new to programming. Expect students to struggle with for loops and functions — you likely will have to do these exercises as a code-along. If time is left over, there is practice on the Coffee Preferences data set. If not, students can use it for more practice at home.

Part 1 : Python Data Types (90 min)

  • Why Python? (5 min)

  • Introduction to Data Types (10 min)

  • Jupyter Notebook (5 min)

  • Python Variables (5 min)

  • Operators (10 min)

  • Integers and Floats (5 min)

  • Strings (10 min)

  • Lists (10 min)

  • Tuples (5 min)

  • Dictionaries (10 min)

  • Importing Packages and Documentation (5 min)

  • Practice With a Partner (10 min)

Part 2 : Python Iterations, Control Flow, and Functions (80 min)

  • If... Else Statements (10 min)

  • Iterating With For Loops (30 min — consider mostly doing as a code-along)

  • Functions (30 min — consider mostly doing as a code-along)

  • While Loops (10 min)

  • Practice control flow on Coffee Preference data set (if time remains, otherwise practice at home)

  • Conclusion


Additional Resources

For more information on this topic, check out the following resources: