MulaiMulai sekarang secara gratis

Exploring list methods and functions

Lists methods and functions are useful for analyses. Functions take objects as inputs or are "passed" an object. Methods, in contrast, act on objects. For lists, useful functions include max() and min(), which identify the maximum or minimum value in a list. A useful list method is .sort() which sorts the elements in a list.

Latihan ini adalah bagian dari kursus

Introduction to Python for Finance

Lihat Kursus

Latihan interaktif praktis

Cobalah latihan ini dengan menyelesaikan kode contoh berikut.

# Print the sorted list prices
prices = [159.54, 37.13, 71.17]
prices.____
print(prices)
Edit dan Jalankan Kode