开始使用免费开始使用

The reduce() function

Now, it is time for some reduction! As before you'll be given three tasks to complete. Use lambda expressions!

The necessary functions from the functools module are already imported for you.

本练习是课程的一部分

Practicing Coding Interview Questions in Python

查看课程

交互式实操练习

通过完成这段示例代码来试试这个练习。

# Reverse a string using reduce()
string = 'DataCamp'
inv_string = reduce(____)
print('Inverted string = ' + inv_string)
编辑并运行代码