This is the code we used for Siri:
#Siri!!
#Restart
restart = 'y'
while restart=='y':
#Importing modules
import random
import time
#Get users name
user_name = input("\nWhat is yor name?\n")
#Write answers.
ans1= "Sure Thing"
ans2= "Why not"
ans3= "Siri Aproves"
ans4= "HaHa Nice!"
ans5= "Go for it"
ans6= "So Cool!"
ans7= "I'm Siri"
ans8= "Cool Story"
print ("Hi",user_name)
print ("Meet Siri.")
#Creates a random wait between shaking.
wait1=random.randint(1,8)
wait2=random.randint(1,8)
wait3=random.randint(1,8)
wait4=random.randint(1,8)
wait5=random.randint(1,8)
#get the users questions.
question= input ("Ask me for advice then press ENTER to shake me?\n")
#Shaking with a random wait time.
print ("Shaking...\n")
time.sleep(wait1)
print ("Shaking...\n")
time.sleep(wait2)
print ("Shaking...\n")
time.sleep(wait3)
print ("Shaking...\n")
time.sleep(wait4)
#Create a dice.
choice=random.randint(1,8)
if choice==1:
answer=ans1
elif choice==2:
answer=ans2
elif choice==3:
answer=ans3
elif choice==4:
answer=ans4
elif choice==5:
answer=ans5
elif choice==6:
answer=ans6
elif choice==7:
answer=ans7
else:
answer=ans8
#Print answer to the screen
print ("You asked -", question)
time.sleep(wait5)
print("Siri says -",answer)
restart= input("\n\n Enter y to to play again\n")
List the improvements you could make to this piece of code.
ReplyDelete