เริ่มต้นใช้งานเริ่มต้นใช้งานได้ฟรี

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)
แก้ไขและรันโค้ด