Skip to content
Advertisement

How to make a part of a code go in loop without duplicate the code in Python

I’m using pyttsx3 to make a talking bot . and it work

JavaScript

but if I want the code to repeat the operation when ever its end I mean if I typed something and got the respond I will get another “type something” input without duplicate the code like this

JavaScript

i tried making a loop but didn’t work

JavaScript

So its going to ask me the a input again and again with no need to duplicate the code

Advertisement

Answer

I think it should work, I really didn’t understand your question, but this is closest to what you asked for

JavaScript

or if you want to try functions you can try:

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement