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

VLSI CAD Part II: Layout (Coursera) Coursera
University of Illinois at Urbana-Champaign

VLSI CAD Part II: Layout (Coursera)

A modern VLSI chip is a remarkably complex beast: billions of transistors, millions of logic gates deployed for computation and control, big blocks of memory, embedded blocks of pre-designed functions designed by third parties (called “intellectual property” or IP blocks). How do people manage to design these complicated chips? Answer: a sequence of computer aided design (CAD) tools takes an abstract description of the chip, and refines it step-wise to a final design.

Sep 21st 2026
5-12 Weeks
Comparing Genes, Proteins, and Genomes (Bioinformatics III) (Coursera) Coursera
University of California, San Diego

Comparing Genes, Proteins, and Genomes (Bioinformatics III) (Coursera)

Once we have sequenced genomes in the previous course, we would like to compare them to determine how species have evolved and what makes them different. In the first half of the course, we will compare two short biological sequences, such as genes (i.e., short sequences of DNA) or proteins. We will encounter a powerful algorithmic tool called dynamic programming that will help us determine the number of mutations that have separated the two genes/proteins.

Sep 14th 2026
5-12 Weeks
Development of Real-Time Systems (Coursera) Coursera
EIT Digital

Development of Real-Time Systems (Coursera)

This course is intended for the Master's student and computer engineer who likes practical programming and problem solving! After completing this course, you will have the knowledge to plan and set-up a real-time system both on paper and in practice. The course centers around the problem of achieving timing correctness in embedded systems, which means to guarantee that the system reacts within the real-time requirements.

Sep 21st 2026
5-12 Weeks
Programming for Data Science (Coursera) Coursera
University of Leeds

Programming for Data Science (Coursera)

Explore the basics of programming and familiarise yourself with the Python language. After completing this course, you will be able to write Python programs in Jupyter Notebook and describe basic programming. In this course, you will learn everything you need to start your programming journey. You will discover the different data types available in Python and how to use them, learn how to apply conditional and looping control structures, and write your own functions.

Sep 21st 2026
3 Weeks
Analíticas de Datos con Pandas (Coursera) Coursera
Tecnológico de Monterrey

Analíticas de Datos con Pandas (Coursera)

La analítica de datos ha avanzado considerablemente en los últimos años y ahora existen diversas herramientas que nos permiten realizar tareas o procesos que antes eran complicados de realizar. Gracias a su versatilidad, el lenguaje de programación Python posee una serie de librerías que permiten realizar proyectos de analítica de datos de una forma muy sencilla y una de las librerías más populares es Pandas.

Sep 21st 2026
4 Weeks
VLSI CAD Part I: Logic (Coursera) Coursera
University of Illinois at Urbana-Champaign

VLSI CAD Part I: Logic (Coursera)

A modern VLSI chip has a zillion parts -- logic, control, memory, interconnect, etc. How do we design these complex chips? Answer: CAD software tools. Learn how to build thesA modern VLSI chip is a remarkably complex beast: billions of transistors, millions of logic gates deployed for computation and control, big blocks of memory, embedded blocks of pre-designed functions designed by third parties (called “intellectual property” or IP blocks). How do people manage to design these complicated chips? Answer: a sequence of computer aided design (CAD) tools takes an abstract description of the chip, and refines it step-wise to a final design.

Sep 21st 2026
5-12 Weeks
An Introduction to Programming using Python (Coursera) Coursera
University of Leeds

An Introduction to Programming using Python (Coursera)

Maximise your employability, by learning the basics of coding in Python. Python is a versatile programming language used for developing websites and software, task automation, data analysis and more. In this course, you'll embark on an exciting journey into the world of Python and gain valuable skills that will enable you to start thinking about a career in programming.

Sep 21st 2026
2 Weeks
Exam Prep AI-102: Microsoft Azure AI Engineer Associate (Coursera) Coursera
Whizlabs

Exam Prep AI-102: Microsoft Azure AI Engineer Associate (Coursera)

The AI-102: Designing and Implementing a Microsoft Azure AI Solution certification exam tests the candidate’s experience and knowledge of the AI solutions that make the most of Azure Cognitive Services and Azure services. In addition, the exam also tests the candidate's ability to implement this knowledge by participating in all phases of AI solutions development—from defining requirements, and design to development, deployment, integration, maintenance, performance tuning, and monitoring.

Sep 21st 2026
5-12 Weeks
Programming with Cloud IoT Platforms (Coursera) Coursera
Pohang University of Science and Technology - POSTECH

Programming with Cloud IoT Platforms (Coursera)

Internet of Things (IoT) is an emerging area of information and communications technology (ICT) involving many disciplines of computer science and engineering including sensors/actuators, communications networking, server platforms, data analytics and smart applications. IoT is considered to be an essential part of the 4th Industrial Revolution along with AI and Big Data.

Sep 21st 2026
5-12 Weeks
Fundamental Skills in Bioinformatics (Coursera) Coursera
King Abdullah University of Science and Technology (KAUST)

Fundamental Skills in Bioinformatics (Coursera)

The course provides a broad and mainly practical overview of fundamental skills for bioinformatics (and, in general, data analysis). The aim is to support the simultaneous development of quantitative and programming skills for biological and biomedical students with little or no background in programming or quantitative analysis.

Sep 21st 2026
4 Weeks