IniziaInizia gratis

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.

Questo esercizio fa parte del corso

Practicing Coding Interview Questions in Python

Visualizza il corso

Esercizio pratico interattivo

Prova a risolvere questo esercizio completando il codice di esempio.

# Reverse a string using reduce()
string = 'DataCamp'
inv_string = reduce(____)
print('Inverted string = ' + inv_string)
Modifica ed esegui il codice