When you enroll in this course, you'll also be enrolled in this Specialization.
Learn new concepts from industry experts
Gain a foundational understanding of a subject or tool
Develop job-relevant skills with hands-on projects
Earn a shareable career certificate
There are 5 modules in this course
This course introduces the dictionary data structure and user-defined functions. You’ll learn about local and global variables, optional and keyword parameter-passing, named functions and lambda expressions. You’ll also learn about Python’s sorted function and how to control the order in which it sorts by passing in another function as an input. For your final project, you’ll read in simulated social media data from a file, compute sentiment scores, and write out .csv files. It covers chapters 10-16 of the textbook “Fundamentals of Python Programming,” which is the accompanying text (optional and free) for this course.
The course is well-suited for you if you have already taken the "Python Basics" course and want to gain further fundamental knowledge of the Python language. Together, both courses are geared towards newcomers to Python programming, those who need a refresher on Python basics, or those who may have had some exposure to Python programming but want a more in-depth exposition and vocabulary for describing and reasoning about programs.
This is a follow-up to the "Python Basics" course (course 1 of the Python 3 Programming Specialization), and it is the second of five courses in the specialization.
In week one the video lectures and the Runestone textbook will introduce you to the idea of incorporating files into your programs as an additional source of data. You will learn how to read from a file, write to a file, and how to work with the .csv data format.
What’s New? Updates and Improvements in the Second Edition•2 minutes
Welcome to Python Functions, Files, and Dictionaries•2 minutes
How to Use the Interactive Textbook•14 minutes
Executing Python in the Jupyter Environment•11 minutes
Introduction: Files•1 minute
Reading a File•10 minutes
Finding a File in Your File System•7 minutes
Writing to a File•8 minutes
Using With to Open Files•5 minutes
Conclusion: Files•1 minute
Introduction: .csv Format•4 minutes
Reading a .csv File•9 minutes
Writing Data to a .csv File•8 minutes
Reading from Files with the csv Module•8 minutes
Writing to Files with the csv Module•7 minutes
Tips on File Naming•6 minutes
Conclusion: .csv Format•1 minute
How to Submit Assessments•3 minutes
Recovering from corrupted assignment notebooks•10 minutes
3 readings•Total 30 minutes
Syllabus•10 minutes
A note on assert•10 minutes
Help Us Learn More About You!•10 minutes
1 programming assignment•Total 60 minutes
Assessment - Files and CSV•60 minutes
13 app items•Total 125 minutes
Use the Runestone Practice Tool•5 minutes
Introduction: Working with Data Files•10 minutes
Reading a File•10 minutes
Alternative File Reading Methods•10 minutes
Iterating Over Lines in a File•10 minutes
Finding a File in your File System•10 minutes
Writing to a File•10 minutes
Using With to Open Files•10 minutes
Recipe for Reading and Processing a File•10 minutes
CSV Format•10 minutes
Reading a .csv File•10 minutes
Writing Data to a .csv File•10 minutes
Tips on Handling Files•10 minutes
3 ungraded labs•Total 180 minutes
(Optional) Getting Started with Jupyter Notebooks•60 minutes
Optional Lab - Testing with Assert•60 minutes
Optional Lab - Reading and Writing Files•60 minutes
Dictionaries and Dictionary Accumulation
Module 2•6 hours to complete
Module details
In week two the video lectures and the Runestone textbook will focus on a new data type, dictionaries. You will be introduced to the mechanics of dictionaries and then get practice using them in accumulation patterns, both to build a dictionary using the pattern as well as find the best, or worst, result using the pattern.
Introduction: Accumulating Multiple Results in a Dictionary•10 minutes
Accumulating Results From a Dictionary•10 minutes
Accumulating the Best Key•10 minutes
When to Use a Dictionary•10 minutes
1 ungraded lab•Total 60 minutes
Optional Lab - Dictionaries•60 minutes
Functions and Tuples
Module 3•10 hours to complete
Module details
In week three you will be introduced to the construction of functions. Up to this point, you have used functions in the programs before, but have not had a chance to write your own functions, including how to define a function, how to incorporate parameters, how to return data from a function, the local or global scope of variables, and potential side effects that could occur from function execution. Finally, we look at tuples more in depth, and how automatic packing and unpacking of tuples can be used in functions and in for loops.
Way of the Programmer: Decoding a Function•4 minutes
A Function that Accumulates•8 minutes
Type Hinting•10 minutes
Conclusion: Functions•1 minute
Introduction: Variable Scoping and Side Effects•1 minute
Local and Global Variables•10 minutes
Function Composition•11 minutes
Mutable Objects and Side Effects•5 minutes
Test Cases for Functions•15 minutes
Way of the Programmer: Enforcing Variable Typing for Function Parameters•4 minutes
Conclusion: Variable Scoping and Side Effects•1 minute
Introduction: Tuple Packing and Unpacking•1 minute
Tuple Packing•3 minutes
Tuple Assignment with Unpacking•9 minutes
Conclusion: Tuple Packing and Unpacking•1 minute
2 programming assignments•Total 120 minutes
Assessment - Functions•60 minutes
Assessment - Tuples•60 minutes
21 app items•Total 260 minutes
Use the Runestone Practice Tool•60 minutes
Introduction to Functions•10 minutes
Function Definition•10 minutes
Function Invocation•10 minutes
Function Parameters•10 minutes
Returning a Value from a Function•10 minutes
Decoding a Function•10 minutes
A Function that Accumulates•10 minutes
Local Variables•10 minutes
Global Variables•10 minutes
Function Composition•10 minutes
Flow of Execution Summary•10 minutes
Print vs. Return•10 minutes
Passing Mutable Objects•10 minutes
Side Effects•10 minutes
Writing Test Cases for Functions•10 minutes
Introduction•10 minutes
Tuple Packing•10 minutes
Tuples as Return Values•10 minutes
Tuple Assignment with Unpacking•10 minutes
Unpacking Tuples as Arguments to Function Calls•10 minutes
2 ungraded labs•Total 120 minutes
Optional Lab - Defining Functions•60 minutes
Optional Lab - Tuple Packing and Unpacking•60 minutes
More Iteration and Advanced Functions
Module 4•9 hours to complete
Module details
In week four the video lectures and the Runestone textbook will outline a more advanced iteration mechanism, the while loop. You will be introduced to using it when getting feedback from users, as well as applying it to the turtle module to draw images. Additionally, you will also be exposed to more advanced function concepts such as the idea of parameters being optional, not required, and anonymous functions using lambda.
In week five the videos and Runestone textbook will detail how to sort python objects - both the basics and more advanced forms of sorting for dictionaries and how to break a tie (if that occurs). The final course assessment will be a project that asks you to read fake, auto-generated data from a social media site to analyze social media post sentiments. You will submit a csv file as well as images of graphs that demonstrate your findings.
The mission of the University of Michigan is to serve the people of Michigan and the world through preeminence in creating, communicating, preserving and applying knowledge, art, and academic values, and in developing leaders and citizens who will challenge the present and enrich the future.
"To be able to take courses at my own pace and rhythm has been an amazing experience. I can learn whenever it fits my schedule and mood."
Jennifer J.
Learner since 2020
"I directly applied the concepts and skills I learned from my courses to an exciting new project at work."
Larry W.
Learner since 2021
"When I need courses on topics that my university doesn't offer, Coursera is one of the best places to go."
Chaitanya A.
"Learning isn't just about being better at your job: it's so much more than that. Coursera allows me to learn without limits."
Learner reviews
4.8
5,444 reviews
5 stars
87.16%
4 stars
11.14%
3 stars
1.19%
2 stars
0.16%
1 star
0.33%
Showing 3 of 5444
A
AS
5·
Reviewed on May 12, 2020
Loved the course curriculum and lot of exercises to practice although it was tough during the project making . Any one should try this course to gain insights to Files , Dictionary .
B
BA
5·
Reviewed on Nov 6, 2019
The course met all my expectations and went beyond. The instructors' explanations were easy to understand and the innovative method of having a digital textbook was undoubtedly convenient.
D
DN
5·
Reviewed on Jan 28, 2020
Great follow-on from the basics with essential information. Well constructed series, well presented lessons, with great practice questions. I feel a big step closer to writing useful python code.
When will I have access to the lectures and assignments?
To access the course materials, assignments and to earn a Certificate, you will need to purchase the Certificate experience when you enroll in a course. You can try a Free Trial instead, or apply for Financial Aid. The course may offer 'Full Course, No Certificate' instead. This option lets you see all course materials, submit required assessments, and get a final grade. This also means that you will not be able to purchase a Certificate experience.
What will I get if I subscribe to this Specialization?
When you enroll in the course, you get access to all of the courses in the Specialization, and you earn a certificate when you complete the work. Your electronic Certificate will be added to your Accomplishments page - from there, you can print your Certificate or add it to your LinkedIn profile.
Is financial aid available?
Yes. In select learning programs, you can apply for financial aid or a scholarship if you can’t afford the enrollment fee. If fin aid or scholarship is available for your learning program selection, you’ll find a link to apply on the description page.