mardi 3 novembre 2015

Python 3 random response

I am making a conversation simulator in python 3 and I have this code so far.

import time
print ("Hello")
age = input("How old are you?")
time.sleep(2)
if age.isdigit() and age >= str(0):
    print ("Ok, cool I am " + age + " too.")
    time.sleep(2)
    yourname = input("What is your name again?")
    print ("Cool, " + yourname + " is a cool name")
    time.sleep(2)
    name = input("Do you remember my name?")
    print ("Ya my name is " + name + " you got it")
else:
    print ("ERROR")

Now I want to add more variety by having "name" ask a random question. I also want to make it so that different responses do different things. How can I do this?




Aucun commentaire:

Enregistrer un commentaire