+ 7

Can I have some help on my code please?

https://code.sololearn.com/cMoWu7qUfono/?ref=app That is the link to my code. I hope it’s not spam and not sure if it’s off topic but it is technically about coding so I don’t know. Does anybody have some suggestions for me? I need a more efficient way to do it but I’m not sure how. Btw it’s in python3. I don’t want you to do it for me, just some suggestions. Thanks,

23rd Feb 2018, 5:32 PM
Jax
Jax - avatar
6 Answers
+ 4
dictionary so that key is english word and value is spanish. then loop over them and check if the english words appear in the string if so replace. rough code, havent tested: for i, j in worddict: if i in inputstring: inputstring = inputstring.replace(i, j)
23rd Feb 2018, 5:54 PM
Markus Kaleton
Markus Kaleton - avatar
+ 3
How would I use a dictionary? I haven’t used those much before. I usually just used strings and variables.
23rd Feb 2018, 5:34 PM
Jax
Jax - avatar
+ 3
Not the greatest in python btw.
23rd Feb 2018, 5:36 PM
Jax
Jax - avatar
+ 2
Use a dictionary.
23rd Feb 2018, 5:33 PM
Louis
Louis - avatar
+ 1
Later
23rd Feb 2018, 5:44 PM
Louis
Louis - avatar
+ 1
This is not perfect, but good enough to illustrate the principle. https://code.sololearn.com/cmvp53Xl1Mkv/#py
24th Feb 2018, 5:51 AM
Louis
Louis - avatar