We may earn an affiliate commission when you visit our partners.
Course image
Coursera logo

Python Functions, Files, and Dictionaries

Paul Resnick and Steve Oney

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.

Read more

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.

Enroll now

What's inside

Syllabus

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.
Read more
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.
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.
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.
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.

Good to know

Know what's good
, what to watch for
, and possible dealbreakers
Develops foundational knowledge of Python, beneficial for those starting their journey in Python programming
Covers core concepts such as variables, data types, and functions in Python, suitable for learning the language's basics
Progresses from beginner-level topics to advanced concepts, catering to a diverse audience of Python learners
Instructed by experienced professionals in the field, known for their expertise in Python programming
Provides various assessment opportunities, including interactive exercises and a final project, to reinforce learning
Covers the fundamentals of working with files and CSV data in Python

Save this course

Save Python Functions, Files, and Dictionaries to your list so you can find it easily later:
Save

Reviews summary

Pythonic functions and files

learners say this Python Functions, Files, and Dictionaries course is largely positive, well-received, and engenders confidence, thanks to the engaging assignments and focus on functions, files, and dictionaries. The interactive textbook, Runestone, and online practice tools are especially popular, and provide opportunities to apply concepts in real time. Some students wish for more challenging assessments.
The course is accessible to beginners, thanks to clear explanations and a well-structured progression of difficulty.
"I also like the special bonus jokes made by Prof Paul Resnick at the end of each section."
"Overall it's a great course. The textbook has been very helpful; I find some of the exercises too easy though."
"This course, which is a part of the specialization course, is one of the skillfully crafted courses. It equips learners with the very important conepts of python programming in a step wise approach."
The instructors, Steve Oney and Paul Resnick, are praised for their teaching abilities, humor, and patience.
"Great instructors and great lectures. The excercises are well thought. The only thing to remark is that the course is a little bit easy."
"Steve Oney and Paul Resnick are terrific as teachers! Thank you very much for your didatism, soft pace and your skill to teach!"
"E​xcellent course and instructor i hope that both of the instructors that taught in this course to teach other course too"
Many reviewers mention the utility of the course's content, highlighting concepts like object-oriented programming, lambda functions, sorting techniques, and file manipulation.
"This course very helpful and suitable for beginner level learners. I learn a lot of things from this course."
"The course was very well-paced, suitable for both beginners in programming and those who have previous programming background."
"If any one wants to learn Python, this is the place. Excellent professors and innovative teaching and projects .Thank you all"
"The course is very well defined. Sometimes the questions seem too easy but actually are very time consuming. Well taught and well balanced."
The interactive textbook and online practice tools are consistently praised by learners for their effectiveness in reinforcing concepts.
"This course gives me an in-depth knowledge on Python using various concepts such as Functions, Files and Dictionaries."
"I am very grateful for such well planned and detailed materials, and a super intuitive platform for newbies like me to poke around and getting familiar with the python environment."
"This is a great course for those learning Python for the first time, or for others (like me) that have learned Python through tutorials but never understood of the basics about dictionaries and lambda functions."
Some learners express frustration with the peer review process, suggesting it can be subjective and challenging.
"The course was excellent!! Some parts of the assessments seemed to be outside of the material presented, but it was exciting and inspirational!! Thank you!"
A few learners feel that the assessments are not challenging enough, and would like to see more rigorous exercises.
"The overall course was easier than the basics I, however, the final project made me think and understand to finish it in time."
"This was a good course, however, the exercises in the homework and on the graded tests could be more challenging..."
"There was a problem in the last assignment, because my code was right but the runestone platform always showed a timelimiterror."

Career center

Learners who complete Python Functions, Files, and Dictionaries will develop knowledge and skills that may be useful to these careers:
Data Scientist
Data Scientists use their knowledge of statistics, programming, and machine learning to build models that can predict outcomes and make recommendations. This course would be helpful for Data Scientists because it teaches how to read and write data from files, use dictionaries to store and organize data, define and use functions to perform complex operations, and sort data to identify patterns and trends.
Machine Learning Engineer
Machine Learning Engineers build and maintain machine learning models that can learn from data and make predictions. This course would be helpful for Machine Learning Engineers because it teaches how to read and write data from files, use dictionaries to store and organize data, define and use functions to perform complex operations, and sort data to identify patterns and trends.
Operations Research Analyst
Operations Research Analysts use data to solve complex problems in business and industry. This course would be helpful for Operations Research Analysts because it teaches how to read and write data from files, use dictionaries to store and organize data, define and use functions to perform complex operations, and sort data to identify patterns and trends.
Statistician
Statisticians use data to design experiments, analyze results, and draw conclusions. This course would be helpful for Statisticians because it teaches how to read and write data from files, use dictionaries to store and organize data, define and use functions to perform complex operations, and sort data to identify patterns and trends.
Software Engineer
Software Engineers design, develop, and maintain software systems. This course would be helpful for Software Engineers because it teaches how to read and write data from files, use dictionaries to store and organize data, define and use functions to perform complex operations, and sort data to identify patterns and trends.
Data Analyst
Data Analysts collect, clean, and analyze data to help businesses make informed decisions. This course would be helpful for Data Analysts because it teaches how to read and write data from files, use dictionaries to store and organize data, define and use functions to perform complex operations, and sort data to identify patterns and trends.
Database Administrator
Database Administrators design, implement, and maintain databases. This course would be helpful for Database Administrators because it teaches how to read and write data from files, use dictionaries to store and organize data, define and use functions to perform complex operations, and sort data to identify patterns and trends.
Web Developer
Web Developers design and develop websites and web applications. This course would be helpful for Web Developers because it teaches how to read and write data from files, use dictionaries to store and organize data, define and use functions to perform complex operations, and sort data to identify patterns and trends.
Financial Analyst
Financial Analysts use data to evaluate the financial performance of companies and make investment recommendations. This course would be helpful for Financial Analysts because it teaches how to read and write data from files, use dictionaries to store and organize data, define and use functions to perform complex operations, and sort data to identify patterns and trends.
Market Researcher
Market Researchers collect and analyze data to understand consumer behavior and market trends. This course would be helpful for Market Researchers because it teaches how to read and write data from files, use dictionaries to store and organize data, define and use functions to perform complex operations, and sort data to identify patterns and trends.
Business Analyst
Business Analysts use data to help businesses understand their operations and make better decisions. This course would be helpful for Business Analysts because it teaches how to read and write data from files, use dictionaries to store and organize data, define and use functions to perform complex operations, and sort data to identify patterns and trends.
Quantitative Analyst
Quantitative Analysts use data to develop and implement financial models. This course would be helpful for Quantitative Analysts because it teaches how to read and write data from files, use dictionaries to store and organize data, define and use functions to perform complex operations, and sort data to identify patterns and trends.
Actuary
Actuaries use data to assess risk and uncertainty. This course would be helpful for Actuaries because it teaches how to read and write data from files, use dictionaries to store and organize data, define and use functions to perform complex operations, and sort data to identify patterns and trends.
Data Engineer
Data Engineers design and build systems for storing and processing data. This course may be useful for Data Engineers because it teaches how to read and write data from files, use dictionaries to store and organize data, define and use functions to perform complex operations, and sort data to identify patterns and trends.
Information Security Analyst
Information Security Analysts protect computer systems and networks from attack. This course may be useful for Information Security Analysts because it teaches how to read and write data from files, use dictionaries to store and organize data, define and use functions to perform complex operations, and sort data to identify patterns and trends.

Reading list

We've selected 13 books that we think will supplement your learning. Use these to develop background knowledge, enrich your coursework, and gain a deeper understanding of the topics covered in Python Functions, Files, and Dictionaries.

Share

Help others find this course page by sharing it with your friends and followers:
Our mission

OpenCourser helps millions of learners each year. People visit us to learn workspace skills, ace their exams, and nurture their curiosity.

Our extensive catalog contains over 50,000 courses and twice as many books. Browse by search, by topic, or even by career interests. We'll match you to the right resources quickly.

Find this site helpful? Tell a friend about us.

Affiliate disclosure

We're supported by our community of learners. When you purchase or subscribe to courses and programs or purchase books, we may earn a commission from our partners.

Your purchases help us maintain our catalog and keep our servers humming without ads.

Thank you for supporting OpenCourser.

© 2016 - 2024 OpenCourser