Menu

#Elif

5 posts

Feed·
5 of 5 posts
0Read More

How can I make this code more efficient? (Shorter)

Reddit r/learnpython·u/ice_or_flames·6 months ago
#EjOaIDnw
#elif#print#height#hair_colour#false

import time young_flag = False ya_flag = False adult_flag = False old_flag = False m_flag = False f_flag = False x_flag = False print("Running program...") print("") time.sleep(1) user = "" while not user.isalpha(): user = input("What is your name?[only…

15s
0Read More

Hi, I’m learning Python and built a simple chatbot using loops and conditions. It can respond to greetings and basic inputs. I’d appreciate feedback on how to improve it or make it smarter.

Reddit r/learnpython·u/Inside-Card9720·7 months ago
#Jqu8dSc2
#user#print#name#input#elif

name = input("Bot: What's your name? ") while True: user = input("You: ").lower() if "hello" in user: print(f"Bot: Hi {name}!") elif "how are you" in user: print("Bot: I'm just code, but I'm doing fine!") elif "bye" in user: print("Bot:

15s