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

Indexing list items

Each item in a list has an assigned indexed value. Remember that Python is a zero indexed language, and the first element in a list is stored at index zero. In this exercise, you will practice subsetting single elements from a list.

Lists names and prices for company names and stock prices are available in your workspace.

Bu egzersiz

Introduction to Python for Finance

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

Egzersiz talimatları

  • Print the first element in names.
  • Print the second element in names.
  • Using a negative index, print the last element in prices.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# Print the first item in names
print(____)

# Print the second item in names
print(____)

# Print the last element in prices
print(____)
Kodu Düzenle ve Çalıştır