+ 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,
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)
+ 3
How would I use a dictionary? I havenât used those much before. I usually just used strings and variables.
+ 3
Not the greatest in python btw.
+ 2
Use a dictionary.
+ 1
Later
+ 1
This is not perfect, but good enough to illustrate the principle.
https://code.sololearn.com/cmvp53Xl1Mkv/#py