2

i am building a translator that translates user input to french using python. I am however encountering a challenge where my goslate function does not catch user input and translate it. I will appreciate your help.

import goslate
gs = goslate.Goslate()

text = input("please input the word you would like translated:\n")
gs.translate(text,'fr')
yvonne
  • 23
  • 2
  • Do you mean when you run the above code you don't see anything on the output console? If that's the case check @trivvz answer. – shuberman Mar 06 '21 at 14:05

1 Answers1

1

You have to print the output or save it to a variable. E.g.

import goslate
gs = goslate.Goslate()
text = input("please input the word you would like translated:\n")
print(gs.translate(text,'fr'))

Output:

please input the word you would like translated:
Hello
Bonjour

Check the documentation for more details.

tpwo
  • 484
  • 3
  • 12