Microsoft
Course Description
Get started with Python in a practical, hands-on way! Learn types in Python like basic data types, tuples, and dictionaries. Understand control flow in Python programs with loops, boolean statements, if statements, and return statements. Then you’ll make concise, reusable functions, learn how to work with files on your filesystem, and write programs that interact with APIs!
This course and others like it are available as part of our Frontend Masters video subscription.
Preview
CloseLearn Straight from the Experts Who Shape the Modern Web
Your Path to Senior Developer and Beyond
- 200+ In-depth courses
- 18 Learning Paths
- Industry Leading Experts
- Live Interactive Workshops
Table of Contents
Introduction
Section Duration: 32 minutes
- Nina Zakharenko introduces the course repository, the course website, and how audience members can connect with her via social media.
- Nina goes over the mandatory prerequisites to be installed before beginning the course.
- Nina demonstrates how to set up a basic file structure, create a python file, and a few handy keyboard shortcuts for VSCode.
- Nina demonstrates how to start Python's read evaluate print loop.
- Nina introduces the basics of how to use the Python REPL.
- Nina demonstrates an error that may occur when reassigning reserved variables, how to write comments, and the basics of how to debug in the REPL
- Nina introduces the context of Python, and resources to find best practice principles.
- Nina walks through a piece of code intended to expose students to the language.
Data Types
Section Duration: 19 minutes
- Nina introduces variables by speaking to naming conventions, a few "gotchas", as well as NoneType and reassigning variables.
- Nina demonstrates how to assign integers, floats, complex numbers. The methods associated with types are also addressed as well as basic mathematical operations.
- Nina introduces best practices for strings, string concatenation, long strings, and f strings
- Students are instructed to display the type of several variables in their REPL. Nina live codes the solution to the exercise.
Functions
Section Duration: 41 minutes
- Nina introduces why functions are useful, demonstrates the syntax for a function, and gives examples to demonstrate what returning a value means.
- Nina demonstrates how to add inputs to functions.
- Nina warns the audience against using empty default lists as a default parameter, due to the mutability rules that will be discussed later in the course.
- Nina covers the basics of the way that access to variables is handled.
- Nina live codes the solution to the exercise.
Lists
Section Duration: 32 minutes
- Nina introduces how to instantiate lists.
- Nina introduces methods to change the order of lists, given their contents, then goes on to view all the methods available to lists, and how to see what a particular method does from the REPL.
- Nina introduces the append, insert, and extend methods built into python.
- Nina demonstrates how to determine if specific objects are in a list, the index of the first time the object is found in a list, and the number of times an object appears in a list.
- Nina introduces the remove, pop, and push
- Nina reviews the methods learned in the previous sections.
Tuples
Section Duration: 11 minutes
- Nina explains why a tuple might be useful, and how to instantiate them.
- Nina demonstrates how to assign variables to a tuple's values for use outside of the tuple.
- Nina reviews what was covered in the previous sections.
Sets
Section Duration: 22 minutes
- Nina introduces what a set is, and why it's a powerful data structure.
- Nina demonstrates how to add elements, and to remove or replace elements.
- Nina demonstrates how to create a set with elements from two sets, how to find the similarities between sets, and how to find how two sets differ. Frozen sets are also briefly covered.
- Nina reviews what was covered in the previous sections.
Dictionaries
Section Duration: 30 minutes
- Nina introduces how dictionaries are composed in Python, then goes on to demonstrate how to access values, and set default values if the value specified is null.
- Nina demonstrates how to add items, remove items, and access either the keys or values independently from each other using built-in functions.
- Nina reviews what was covered in the previous sections.
- Nina briefly reviews what mutability is, and covers reinforced which data structures in Python are mutable.
- Students are instructed to try typing out their own lists, dictionaries, tuples, and sets using the instructions on the course website. Nina live codes the exercise with students.
Boolean Logic
Section Duration: 18 minutes
- Nina introduces truthyness and falseyness in Python.
- Nina introduces equality and identity.
- Nina introduces boolean logic built in to Python.
- Nina live code the exercise with students.
Looping & Control Flow
Section Duration: 23 minutes
- Nina introduces "for in" syntax as well as how to utilize the range keyword.
- Nina demonstrates how to loop over dictionaries.
- Nina demonstrates how to utilize control flow logic statements.
- Nina demonstrates how to implement while loops, continue, and break.
Real-World
Section Duration: 46 minutes
- Nina demonstrates how to start a file in Python, and enable syntax highlighting.
- Nina demonstrates how to debug a python file using print statements.
- Nina demonstrates how to import files into another file, how to create a module using dunder name, and briefly gives an example of how to include an error message in your log.
- Nina introduces PIP, which is a tool that allows users to install external libraries.
- Nina explains what APIs are, responses, status codes, and authentication.
- Nina demonstrates how to utilize a library that specializes in helping with API requests to get pictures of dogs from an API.
- Students are instructed to utilize the Github API to query for popular courses and sort them by the number of stars that they have. Nina begins live-coding the solution by showing how to begin using Github API.
- Nina demonstrates how to apply search parameters to the Github API query, and starts to divide the code into separate functions.
- Nina demonstrates how to add error handling to the code so that the user is given a useful error should the API not return the correct response.
Wrap Up
Section Duration:
- Nina gives some next steps to programmers who want to learn more about Python.
Learn Straight from the Experts Who Shape the Modern Web
- In-depth Courses
- Industry Leading Experts
- Learning Paths
- Live Interactive Workshops