Ask coding questions

← Back to all posts
Python chat
vrony (2)

On Python I want to create a chat with the computer and user- how do I create True or False statements eg. if yes/true, then print...?


As OmniShift said you can have a variable lets call it choice and you could just use an if statement.

choice = input("you are given 2 boxes. Box A and box B what do you choose?") 
if choice == "A": 
     #If box A is chosen do this
if choice == "B": 
    #If box B is chosen do this
OmniShift (31)
if (userSays == "Hello"):
    print("Computer: Hello, world!")

userSays can be anything, it's just an example of how to write what are called conditions (see: