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

Writing list comprehensions

You now have all the knowledge necessary to begin writing list comprehensions! Your job in this exercise is to write a list comprehension that produces a list of the squares of the numbers ranging from 0 to 9.

Bu egzersiz

Python Toolbox

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

Egzersiz talimatları

  • Using the range of numbers from 0 to 9 as your iterable and i as your iterator variable, write a list comprehension that produces a list of numbers consisting of the squared values of i.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# Create list comprehension: squares
squares = [____ for ____ in ____]
Kodu Düzenle ve Çalıştır