Packt
Advanced Python Features and Functions

通过 Coursera Plus 获取 10,000 多门课程的 Accessibility

Packt

Advanced Python Features and Functions

包含在 Coursera Plus

深入了解一个主题并学习基础知识。
中级 等级

推荐体验

2 周 完成
在 10 小时 一周
灵活的计划
自行安排学习进度
深入了解一个主题并学习基础知识。
中级 等级

推荐体验

2 周 完成
在 10 小时 一周
灵活的计划
自行安排学习进度

您将学到什么

  • Master advanced Python functions like lambdas, decorators, and error handling.

  • Learn how to manage function arguments, including mutable and immutable objects.

  • Understand the practical applications of sequence unpacking and comprehensions.

  • Gain confidence in using Python's more advanced techniques to write cleaner, more efficient code.

要了解的详细信息

可分享的证书

添加到您的领英档案

最近已更新!

September 2025

作业

23 项作业

授课语言:英语(English)

了解顶级公司的员工如何掌握热门技能

Petrobras, TATA, Danone, Capgemini, P&G 和 L'Oreal 的徽标

积累特定领域的专业知识

本课程是 Python - Complete Python, Django, Data Science and ML Guide 专项课程 专项课程的一部分
在注册此课程时,您还会同时注册此专项课程。
  • 向行业专家学习新概念
  • 获得对主题或工具的基础理解
  • 通过实践项目培养工作相关技能
  • 获得可共享的职业证书

该课程共有21个模块

In this module, we will dive into Python functions, explaining their structure and purpose in organizing code. You'll also discover how to call functions, distinguish between parameters and arguments, and explore Python's flexibility with return values and optional parameters. The module wraps up with an introduction to creating concise, one-liner functions in Python.

涵盖的内容

3个视频2篇阅读材料1个作业

In this module, we will delve into the different types of function arguments in Python, from mutable and immutable objects to positional arguments. You'll get hands-on practice with essential concepts like *args and learn how to manage both mandatory and optional arguments. The module concludes with a challenge to build a function that combines two lists into a dictionary, reinforcing your understanding of function argument handling.

涵盖的内容

5个视频1个作业

In this module, we will explore the versatile capabilities of *args and **kwargs in Python functions. You’ll learn how to manage varying numbers of positional and keyword arguments, which enhances your functions' flexibility and readability. Through practical exercises and tasks, you'll gain hands-on experience combining these techniques to create dynamic and reusable functions.

涵盖的内容

8个视频1个作业

In this module, we will focus on default function parameters and how they enhance the flexibility of your functions. You’ll learn how to set default values for parameters, making them optional, and see how this can be combined with positional and keyword arguments to create versatile functions. Hands-on practice will reinforce how to effectively use default parameters in real-world scenarios.

涵盖的内容

2个视频1个作业

In this module, we will explore the essential practice of documenting Python code using docstrings. You'll learn how to effectively document your functions, classes, and modules, providing clear descriptions for parameters and return values. We’ll also cover how to implement type hints and best practices for writing docstrings that make your code more accessible to other developers, ensuring maintainability and clarity.

涵盖的内容

4个视频1个作业

In this module, we will dive into callback functions and their role in enabling one function to be passed as an argument to another. You'll learn how this technique helps in separating concerns and allowing delayed execution. Additionally, we'll explore best practices for function naming and design to create clean, testable, and reusable code.

涵盖的内容

2个视频1个作业

In this module, we will explore the concept of variable scopes in Python, distinguishing between global and local variables. You'll learn how to use the "global" keyword to modify global variables inside functions and understand when and how to use it effectively. Through practical examples, you'll gain a deeper understanding of variable precedence and best practices for avoiding conflicts in your code.

涵盖的内容

4个视频1个作业

In this module, we will explore the different types of operators in Python, from arithmetic to logical, and understand their role in forming expressions. You’ll gain clarity on unary and binary operators and their impact on variables and objects. Through hands-on tasks, you'll learn how to apply comparison operators and check element presence in collections like sets, reinforcing your understanding of Python’s operator system.

涵盖的内容

4个视频1个作业

In this module, we will explore the concept of falsy and truthy values in Python, focusing on how certain values like 0, False, None, and empty sequences are treated as "false" in conditional statements. You'll also learn about truthy values and how to use these distinctions in your code to streamline logical operations and condition evaluations.

涵盖的内容

2个视频1个作业

In this module, we will dive into Python's logical and comparison operators. You'll learn how logical operators work, with a focus on short-circuit evaluation, and how to combine them effectively using parentheses. The module also covers comparison operators for making decisions based on conditions and introduces the "del" statement for removing elements from mutable sequences, expanding your knowledge of Python’s decision-making tools.

涵盖的内容

7个视频1个作业

In this module, we will dive into the world of Lambda functions, exploring their syntax and practical use-cases in Python. You'll learn how to return Lambda functions from other functions, enabling dynamic function creation, and see how to use them for tasks like sorting and filtering lists. Through hands-on examples, you'll understand the versatility and efficiency Lambda functions bring to Python development.

涵盖的内容

4个视频1个作业

In this module, we will explore Python’s error-handling mechanisms, focusing on the try-except block, as well as the use of else and finally for more control over error handling. You'll also learn to handle multiple types of errors, raise custom errors, and handle specific scenarios like file not found or undefined variables. Through hands-on exercises, you'll gain confidence in managing errors gracefully, ensuring your programs run smoothly even when unexpected situations arise.

涵盖的内容

10个视频1个作业

In this module, we will explore the power of sequence unpacking in Python, which allows you to extract values from lists, tuples, and dictionaries directly into variables. You'll learn how to handle different unpacking scenarios, including nested sequences and remaining or selected elements, to simplify your code. Additionally, we will show you how to use unpacking in function calls to pass values as positional and keyword arguments seamlessly.

涵盖的内容

8个视频1个作业

In this module, we will explore the dictionary unpacking operator (**) in Python, showing you how to create and modify dictionaries without altering the originals. You'll learn how to merge multiple dictionaries and control the order of key-value pairs, making it easier to manage settings and configurations. Practical examples will help you master the flexibility and power of dictionary unpacking in your Python projects.

涵盖的内容

3个视频1个作业

In this module, we will explore Python's conditional statements, focusing on how to use if, elif, and else effectively in your code. You’ll learn how to structure conditions, utilize logical operators, and understand the importance of evaluating expressions. Practical examples, including functions for calculating discounts and school grades, will help you refine your conditional logic skills and improve your Python coding efficiency.

涵盖的内容

10个视频1个作业

In this module, we will dive into the ternary operator in Python, showing you how to use it to write concise conditional expressions. You'll learn how to apply it for tasks like toggling user statuses, calculating discounts, and processing data with more efficient conditional logic. Through practical examples, you'll see how the ternary operator can simplify your code and handle complex conditions in a single line.

涵盖的内容

5个视频1个作业

In this module, we will explore Python's "for-in" loop, focusing on how to iterate over a variety of sequences like lists, tuples, dictionaries, sets, and strings. You'll learn how to efficiently unpack tuples and use the "range" function within loops. Practical exercises will help you master the flexibility of the "for-in" loop, empowering you to work with diverse data structures and solve real-world problems with ease.

涵盖的内容

6个视频1个作业

In this module, we will dive into Python's "while" loop, exploring its condition-based iteration and key differences from the "for-in" loop. You’ll learn how to control loops with the "continue" and "break" statements and how to use "while" loops in practical scenarios, including managing user inputs and creating interactive programs. Hands-on tasks will help you build a solid understanding of controlling flow and handling user-driven decisions in your Python applications.

涵盖的内容

6个视频1个作业

In this module, we will explore Python's powerful "for-in" comprehensions, which allow you to create concise, efficient code for transforming and filtering sequences. You'll learn how to use comprehensions for lists, sets, and dictionaries, applying them to real-world examples like converting lists to tuples and merging sequences into dictionaries. Hands-on exercises will help you grasp the full potential of comprehensions, including advanced techniques like nested and conditional comprehensions for more complex tasks.

涵盖的内容

11个视频1个作业

In this module, we will dive into Python generators, exploring how they provide memory-efficient solutions for working with large datasets. You’ll learn the differences between generators and sequences like lists and tuples, and see hands-on examples demonstrating their advantages. Practical exercises will help you master iteration over generators and understand their behavior, especially when re-iterating over them.

涵盖的内容

2个视频1个作业

In this module, we will dive into Python's decorator functions, which allow you to enhance or modify functions in a clean and modular way. You’ll learn how decorators work with *args and **kwargs for argument handling and see practical examples, like adding security checks or logging functionality. Through hands-on examples, you'll discover how decorators improve the flexibility and maintainability of your code.

涵盖的内容

4个视频1篇阅读材料3个作业

获得职业证书

将此证书添加到您的 LinkedIn 个人资料、简历或履历中。在社交媒体和绩效考核中分享。

位教师

Packt - Course Instructors
Packt
1,186 门课程292,430 名学生

提供方

Packt

从 Software Development 浏览更多内容

人们为什么选择 Coursera 来帮助自己实现职业发展

Felipe M.
自 2018开始学习的学生
''能够按照自己的速度和节奏学习课程是一次很棒的经历。只要符合自己的时间表和心情,我就可以学习。'
Jennifer J.
自 2020开始学习的学生
''我直接将从课程中学到的概念和技能应用到一个令人兴奋的新工作项目中。'
Larry W.
自 2021开始学习的学生
''如果我的大学不提供我需要的主题课程,Coursera 便是最好的去处之一。'
Chaitanya A.
''学习不仅仅是在工作中做的更好:它远不止于此。Coursera 让我无限制地学习。'
Coursera Plus

通过 Coursera Plus 开启新生涯

无限制访问 10,000+ 世界一流的课程、实践项目和就业就绪证书课程 - 所有这些都包含在您的订阅中

通过在线学位推动您的职业生涯

获取世界一流大学的学位 - 100% 在线

加入超过 3400 家选择 Coursera for Business 的全球公司

提升员工的技能,使其在数字经济中脱颖而出

常见问题