How to solve this index error? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to solve this index error?

It is a program which converts the input given by you to number. It works by taking your words and comparing it in the dictionary. This program works fine with simply numbers like two hundred or seventy. But reaching complex numbers like two hundred thirty it collapses! Try giving input as three hundred forty five! https://code.sololearn.com/cgWdAh3360sX/?ref=app

18th Jun 2020, 9:36 AM
Mohammad Ansah Kuriyodath
Mohammad Ansah Kuriyodath - avatar
6 Answers
+ 3
line 7, try len(l)-1
18th Jun 2020, 9:53 AM
Taste
Taste - avatar
+ 2
What's the input and expected output? I ran your code and didn't get any errors.
18th Jun 2020, 9:43 AM
Olivia
Olivia - avatar
+ 2
-1 in Len(l) ...range Len((l)-1)
18th Jun 2020, 9:54 AM
Olivia
Olivia - avatar
+ 1
Can you tell at what input it's showing error!
18th Jun 2020, 9:47 AM
Hacker Badshah
Hacker Badshah - avatar
+ 1
Hacker Badshah try giving three hundred twenty three Olivia try entering "three hundred forty six".. I hope you found the error
18th Jun 2020, 9:49 AM
Mohammad Ansah Kuriyodath
Mohammad Ansah Kuriyodath - avatar
+ 1
Remember to give in words it outputs number for it!
18th Jun 2020, 9:49 AM
Mohammad Ansah Kuriyodath
Mohammad Ansah Kuriyodath - avatar