The 365 Data Science team is proud to invite you to our own community forum. A very well built system to support your queries, questions and give the chance to show your knowledge and help others in their path of becoming Data Science specialists.
Ask
Anybody can ask a question
Answer
Anybody can answer
Vote
The best answers are voted up and moderated by our team

error ‘list index is out of range’

error ‘list index is out of range’

0
Votes
0
Answer

my code is exactly as per given solution, but it is giving error : “list index is out of range”

code:

company_names =  [‘Python DS’, ‘PythonSoft’, ‘Pythazon’ ‘Pybook’]
key_name            =  [‘open’, ‘high’, ‘low’, ‘close’]
prices                   =  [[12.87, 13.23, 11.42, 13.10],[23.54, 25.76, 21.87, 22.33],[98.99, 102.34, 97.21, 100.065],[203.63, 207.54, 202.43, 205.24]]

d_1 = {}

for i in range(len(key_name)):

d_1[company_names[i]]= dict(zip(key_name,prices[i]))

print (d_1)

not getting why eroor is occuring.

No answers so far.
×
EXTENDED SALE
Learn Data Science this Summer!
Get 50% OFF