Python Functions, Files, and Dictionaries (Coursera)

Python Functions, Files, and Dictionaries (Coursera)

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.

Class Deals by MOOC List - Click here and see Coursera's Active Discounts, Deals, and Promo Codes.

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.
Course 2 of 5 in the Python 3 Programming Specialization.

Syllabus

WEEK 1
Files and CSV Output
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.

WEEK 2
Dictionaries and Dictionary Accumulation
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.

WEEK 3
Functions and Tuples
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.

WEEK 4
More Iteration and Advanced Functions
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.

WEEK 5
Sorting
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.

Go to Class
MOOC List is learner-supported. When you buy through links on our site, we may earn an affiliate commission.

Related Courses

Python and Statistics for Financial Analysis (Coursera) Coursera
The Hong Kong University of Science and Technology - HKUST

Python and Statistics for Financial Analysis (Coursera)

Python is now becoming the number 1 programming language for data science. Due to python’s simplicity and high readability, it is gaining its importance in the financial industry. The course combines both python coding and statistical concepts and applies into analyzing financial data, such as stock data.

Aug 10th 2026
4 Weeks
Introduction à la programmation orientée objet (en Java) (Coursera) Coursera
École Polytechnique Fédérale de Lausanne

Introduction à la programmation orientée objet (en Java) (Coursera)

Ce cours introduit la programmation orientée objet (encapsulation, abstration, héritage, polymorphisme) en l'illustrant en langage Java. Il présuppose connues les bases de la programmation (variables, types, boucles, fonctions, ...). Il est conçu comme la suite du cours « Initiation à la programmation (en Java) ».

Aug 16th 2026
5-12 Weeks
Programming Fundamentals (Coursera) Coursera
Duke University

Programming Fundamentals (Coursera)

Programming is an increasingly important skill, whether you aspire to a career in software development, or in other fields. This course is the first in the specialization Introduction to Programming in C, but its lessons extend to any language you might want to learn. This is because programming is fundamentally about figuring out how to solve a class of problems and writing the algorithm, a clear set of steps to solve any problem in its class.

Aug 10th 2026
4 Weeks
Algorithmic Thinking (Part 2) (Coursera) Coursera
Rice University

Algorithmic Thinking (Part 2) (Coursera)

Experienced Computer Scientists analyze and solve computational problems at a level of abstraction that is beyond that of any particular programming language. This two-part class is designed to train students in the mathematical concepts and process of "Algorithmic Thinking", allowing them to build simpler, more efficient solutions to computational problems.

Aug 10th 2026
4 Weeks
Data Processing Using Python (Coursera) Coursera
Nanjing University

Data Processing Using Python (Coursera)

This course is mainly for non-computer majors. It starts with the basic syntax of Python, to how to acquire data in Python locally and from network, to how to present data, then to how to conduct basic and advanced statistic analysis and visualization of data, and finally to how to design a simple GUI to present and process data, advancing level by level.

Aug 10th 2026
5-12 Weeks
Global Warming II: Create Your Own Models in Python (Coursera) Coursera
University of Chicago

Global Warming II: Create Your Own Models in Python (Coursera)

This class provides a series of Python programming exercises intended to explore the use of numerical modeling in the Earth system and climate sciences. The scientific background for these models is presented in a companion class, Global Warming I: The Science and Modeling of Climate Change. This class assumes that you are new to Python programming (and this is indeed a great way to learn Python!), but that you will be able to pick up an elementary knowledge of Python syntax from another class or from on-line tutorials.

Aug 10th 2026
5-12 Weeks
Visualization for Data Journalism (Coursera) Coursera
University of Illinois at Urbana-Champaign

Visualization for Data Journalism (Coursera)

While telling stories with data has been part of the news practice since its earliest days, it is in the midst of a renaissance. Graphics desks which used to be deemed as “the art department,” a subfield outside the work of newsrooms, are becoming a core part of newsrooms’ operation. Those people (they often have various titles: data journalists, news artists, graphic reporters, developers, etc.) who design news graphics are expected to be full-fledged journalists and work closely with reporters and editors.

Aug 10th 2026
5-12 Weeks
Principles of Computing (Part 2) (Coursera) Coursera
Rice University

Principles of Computing (Part 2) (Coursera)

This two-part course introduces the basic mathematical and programming principles that underlie much of Computer Science. Understanding these principles is crucial to the process of creating efficient and well-structured solutions for computational problems. To get hands-on experience working with these concepts, we will use the Python programming language. The main focus of the class will be weekly mini-projects that build upon the mathematical and programming principles that are taught in the class.

Aug 10th 2026
4 Weeks
Introducción a Java (Coursera) Coursera
Universidad Nacional Autónoma de México

Introducción a Java (Coursera)

Me llamo Elisa Viso y una de mis pasiones es la de programar y enseñar a programar. El lenguaje Java es uno de los que más me ha gustado en mis 45 años que llevo programando. Si bien te podrá parecer un poco complicado empezar a programar en Java, una vez que cubras los conceptos básicos verás qué rápido se avanza. Java, como todos los lenguajes de programación bien hechos, te dejan hacer cualquier cosa (algunas de ellas con más trabajo que en otros lenguajes y otras casi directamente de cómo piensas la solución al problema).

Aug 10th 2026
5-12 Weeks