Finance के लिए Python परिचय
Adina Howe
Professor
prices.sort()type(prices)list.method() की तरह एक्सेस करेंlist.sort() list के elements को ascending order में sort करता है
prices = [238.11, 237.81, 238.91]prices.sort()print(prices)
[237.81, 238.11, 238.91]
list.append() list में एक element जोड़ता है
months = ['January', 'February', 'March']months.append('April')print(months)
['January', 'February', 'March', 'April']
list.extend() list में हर element जोड़ता है
months.extend(['May', 'June', 'July'])print(months)
['January', 'February', 'March', 'April', 'May', 'June', 'July']
list.index(x) वह सबसे छोटा index देता है जहाँ element x आता है
months = ['January', 'February', 'March']
prices = [238.11, 237.81, 238.91]
months.index('February')
1
print(prices[1])
237.81
min(list): सबसे छोटा element देता है
max(list): सबसे बड़ा element देता है
months = ['January', 'February', 'March']
prices = [238.11, 237.81, 238.91]
# Identify min price min_price = min(prices)# Identify min price index min_index = prices.index(min_price)# Identify the month with min price min_month = months[min_index] print(min_month)
February
Finance के लिए Python परिचय