Last active

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

Teaching My Computer to Talk

View counting.py
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
import os
 
os.system("Say Human, could you please teach me how to count from 1 to 10? Yes or No: ")
input = raw_input('')
 
 
if input in ["Yes", "yes", "YES", "Yes.", "yes.", "YES."]:
os.system("Say Yay! Please give me the digits now: ")
response = raw_input('')
if response in ["1 2 3 4 5 6 7 8 9 10", "1, 2, 3, 4, 5, 6, 7, 8, 9, 10"]:
os.system("Say %s" % response)
os.system("Say Yay, I did it!")
else:
os.system("Say That does not seem right, Human.")
if input in ["No", "no", "NO", "No.", "no.", "NO."]:
os.system("Say OK, I am sorry I asked.")
def count(input):
for i in range(input):
os.system("Say %s" % input)
View counting.py
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
import os
 
os.system("Say Human, could you please teach me how to count from 1 to 10? Yes or No: ")
input = raw_input('')
 
 
if input in ["Yes", "yes", "YES", "Yes.", "yes.", "YES."]:
os.system("Say Yay! Please give me the digits now: ")
response = raw_input('')
if response in ["1 2 3 4 5 6 7 8 9 10", "1, 2, 3, 4, 5, 6, 7, 8, 9, 10"]:
os.system("Say %s" % response)
os.system("Say Yay, I did it!")
os.system("Say Let me show you now. Please enter a single-digit integer.")
integer = raw_input('')
integer = int(integer)
while integer < 15:
integer = integer + 1
os.system("Say %i" % integer)
else:
os.system("Say That does not seem right, Human.")
if input in ["No", "no", "NO", "No.", "no.", "NO."]:
os.system("Say OK, I am sorry I asked.")
View counting.py
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
import os
 
os.system("Say -v Zarvox Human, could you please teach me how to count from 1 to 10? Yes or No: ")
input = raw_input('')
 
 
if input in ["Yes", "yes", "YES", "Yes.", "yes.", "YES."]:
os.system("Say -v Zarvox Yay! Please give me the digits now: ")
response = raw_input('')
if response in ["1 2 3 4 5 6 7 8 9 10", "1, 2, 3, 4, 5, 6, 7, 8, 9, 10"]:
os.system("Say -v Zarvox %s" % response)
os.system("Say -v Zarvox Yay, I did it!")
os.system("Say -v Zarvox Let me show you now. Please enter a single-digit integer.")
integer = raw_input('')
integer = int(integer)
while integer < 15:
integer = integer + 1
os.system("Say -v Zarvox %i" % integer)
else:
os.system("Say -v Zarvox That does not seem right, Human. Please do it again.")
response = raw_input('')
if response in ["1 2 3 4 5 6 7 8 9 10", "1, 2, 3, 4, 5, 6, 7, 8, 9, 10"]:
os.system("Say -v Zarvox %s" % response)
os.system("Say -v Zarvox Yay, I did it!")
os.system("Say -v Zarvox Let me show you now. Please enter a single-digit integer.")
integer = raw_input('')
integer = int(integer)
while integer < 15:
integer = integer + 1
os.system("Say -v Zarvox %i" % integer)
if input in ["No", "no", "NO", "No.", "no.", "NO."]:
os.system("Say -v Zarvox OK, I am sorry I asked.")
View counting.py
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
import os
 
def counting(response):
if response in ["1 2 3 4 5 6 7 8 9 10", "1, 2, 3, 4, 5, 6, 7, 8, 9, 10"]:
os.system("Say -v Zarvox %s" % response)
os.system("Say -v Zarvox Yay, I did it!")
os.system("Say -v Zarvox Let me show you now. Please enter a single-digit integer.")
integer = raw_input('')
integer = int(integer)
while integer < 15:
integer = integer + 1
os.system("Say -v Zarvox %i" % integer)
else:
os.system("Say -v Zarvox That does not seem right, Human. Please do it again.")
response = raw_input('')
counting(response);
 
os.system("Say -v Zarvox Human, could you please teach me how to count from 1 to 10? Yes or No:")
input = raw_input('')
 
if input in ["Yes", "yes", "YES", "Yes.", "yes.", "YES."]:
os.system("Say -v Zarvox Yay! Please give me the digits now:")
response = raw_input('')
counting(response);
if input in ["No", "no", "NO", "No.", "no.", "NO."]:
os.system("Say -v Zarvox OK, I am sorry I asked.")
View counting.py
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
import os
 
digits = range(1,11)
separators = [" ",", "]
 
def counting(response):
if response in [sep.join(str(x) for x in digits) for sep in separators]:
os.system("Say -v Zarvox %s" % response)
os.system("Say -v Zarvox Yay, I did it!")
os.system("Say -v Zarvox Let me show you now. Please enter a single-digit integer.")
integer = raw_input('')
integer = int(integer)
for i in range(integer + 1, 16):
os.system("Say -v Zarvox %i" % i)
else:
os.system("Say -v Zarvox That does not seem right, Human. Please do it again.")
response = raw_input('')
counting(response);
 
if __name__ == '__main__':
os.system("Say -v Zarvox Human, could you please teach me how to count from 1 to 10? Yes or No:")
answer = raw_input('')
 
if answer.lower().startswith("yes"):
os.system("Say -v Zarvox Yay! Please give me the digits now:")
response = raw_input('')
counting(response);
else:
os.system("Say -v Zarvox OK, I am sorry I asked.")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.