MulaiMulai sekarang secara gratis

Using decorator syntax

You have written a decorator called print_args that prints out all of the arguments and their values any time a function that it is decorating gets called.

Latihan ini adalah bagian dari kursus

Writing Functions in Python

Lihat Kursus

Latihan interaktif praktis

Cobalah latihan ini dengan menyelesaikan kode contoh berikut.

def my_function(a, b, c):
  print(a + b + c)

# Decorate my_function() with the print_args() decorator
my_function = ____

my_function(1, 2, 3)
Edit dan Jalankan Kode