No Numerals | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
- 1

No Numerals

s=input(). replace("10","ten") d={1:"one",2:"two",3:"three",4:"four",5:"five",6:"six",7:"seven",8:"eight",9:"nine",10:"ten"} for i in d.keys() : s=s.replace(str(i),d[i]) print (s)

26th Aug 2021, 1:39 AM
Doaa Amin
Doaa Amin - avatar
4 Respostas
+ 9
And your question is ā“
26th Aug 2021, 1:46 AM
Simba
Simba - avatar
+ 3
Doaa Amin Change d[i] to d[i-1] and the code should work just fine, the index of every collection always starts with 0 in most programming languages.
26th Aug 2021, 3:31 AM
Tim
Tim - avatar
+ 1
Doaa Amin Just note that these two lines are similar: for x in d.keys(): ... And for x in d: ...
26th Aug 2021, 6:01 AM
Calvin Thomas
Calvin Thomas - avatar
+ 1
Simba šŸ˜šŸ˜†.
26th Aug 2021, 4:14 PM
Harshit Jawla
Harshit Jawla - avatar