Thursday, October 5, 2023

Python program to find the length and cost of a stock portfolio.

 d10={'tvs':1500,'tm':616,'axis':1000,'icici':950,'infy':1450,'wipro':400,'auro':875,'lupin':1150,'hindalco':470,'tisco':125,'pfc':240,'idfc first':92,'bob':212,'rec':280,'bel':140 }

l10 = len(d10)

s10=sum(d10.values())


print('d10: ',end='')

print(d10)

print('Sum of d10: ' + str(s10)) #9500

print('Number of stocks in d10: ' + str(l10))

print()


d25={'tvs':1500,'tm':616,'axis':1000,'icici':950,'infy':1450,'wipro':400,'auro':875,'lupin':1150,'hindalco':470,'tisco':125,'lt':3075,'polycab':5270,'titan':3215,'trent':2050,'hal':1950 }

l25 = len(d25)

s25=sum(d25.values())


print('d25: ',end='')

print(d25)

print('Sum of d25 :' + str(s25)) #24100

print('Number of stocks in d25: ' + str(l25))


No comments:

Post a Comment

Derivatives stock list at NSE

Complete FNO stock list at NSE. ABB India Ltd ACC Ltd APL Apollo Tubes Ltd AU Small Finance Bank Ltd Aarti Industries Ltd Abbott India Ltd A...