Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Modifying Functions | Functions
Introduction to Python

Modifying Functions

Let's revisit the example with the country information. What happens if the name parameter isn't found in the data?

Can we manage this problem? Absolutely, by implementing conditional statements!

Note

d.keys() is a method used with dictionaries that produces a list of all keys in the dictionary d. Here, it's utilized to verify whether the name is present in the dictionary's keys.

As demonstrated, the error message in this updated format is more user-friendly. While there are many other potential errors and methods to handle them, they're outside the purview of this course.

Все було зрозуміло?

Секція 6. Розділ 9
course content

Зміст курсу

Introduction to Python

Modifying Functions

Let's revisit the example with the country information. What happens if the name parameter isn't found in the data?

Can we manage this problem? Absolutely, by implementing conditional statements!

Note

d.keys() is a method used with dictionaries that produces a list of all keys in the dictionary d. Here, it's utilized to verify whether the name is present in the dictionary's keys.

As demonstrated, the error message in this updated format is more user-friendly. While there are many other potential errors and methods to handle them, they're outside the purview of this course.

Все було зрозуміло?

Секція 6. Розділ 9
some-alt