Here is my code:
start_bot=input("Enter '/start' to start the bot: ")
while start_bot!=("/start"):
print (input("Enter start!"))
if start_bot==("/start"):
print("Welcome!")
If you run and type "/start" it will display "welcome". If you run and type "/non-start" it will display "Enter start", then I will type "/start" and run and it will display "Enter start" again. What’s the problem?
>Solution :
I guess you need to set the last conditional statement out of the loop, and reassign the start_bot variable inside it:
start_bot=input("Enter '/start' to start the bot: ")
while start_bot!=("/start"):
start_bot=input("Enter start!")
print("Welcome!")
Output
Enter '/start' to start the bot: /no
Enter start!/start
Welcome!