0

I have seen a lot of examples in here but I haven't got what I wanted. All of the examples which I have seen make Python speak only what is typed.

Ex. speaker.speak('What is your name?')

But instead of making python speak whatever is typed, I want this:

a = 2+2
speaker.speak('Your answer is',a)

How to make it speak a calculated variable. Here, it should speak Your answer is 4, but it's only speaking Your answer is.

freak
  • 1
  • 1

1 Answers1

-1

Try to set the entire sentence to a variable. For example:

text_to_speak = "Your answer is " + str(a)
speaker.speak(text_to_speak)
thisisnotshort
  • 342
  • 3
  • 11