BaşlayınÜcretsiz Başlayın

Correct an "impure" function

While helping your coworker with their data processing task, you couldn't help but notice that some of the functions they have written are actually not pure functions. Oops! It seems like maybe they almost grasped the concept, but not quite yet. Now you're going to have to help them by making a couple of corrections to what they've written.

Bu egzersiz

Programming Paradigm Concepts

kursunun bir parçasıdır
Kursu Görüntüle

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# Pass in all needed variables as parameters
def scale_list(input_list):
    new_list = []
    for item in input_list:
        # Don't rely on variables that aren't passed in as parameters
        new_item = (item - mean_shift) / scaling_value
        new_list.append(new_item)
    return new_list
Kodu Düzenle ve Çalıştır