Advertisement
Guest User

Untitled

a guest
Mar 23rd, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.18 KB | None | 0 0
  1. def robot_wait():
  2. input("press enter to continue..")
  3.  
  4. def robot_chat():
  5. print("Hi, my name is Sarvesh")
  6. print("What's your name?")
  7. first_name = input("Enter your name: ")
  8.  
  9. print("how are you feeling today")
  10. print((first_name) + ("?"))
  11.  
  12. happiness = input("How are you feeling today? : ")
  13. print("oh ok")
  14.  
  15. reasoning = input("why? : ")
  16. print("Ok, let's change the topic")
  17.  
  18. print("What do you want to talk about?")
  19. topic = input("What do you want to talk about? : ")
  20. print(("what do you know about the ") + (topic) + ("?"))
  21. fact = input(("what do you know about ") + (topic) +("? : "))
  22. print(fact)
  23. print("oh that's a interesting fact.")
  24.  
  25. myname = "Sarvesh"
  26. fsubject = input("What's your favourite subject in school? :")
  27. msubject = "Math"
  28. print(("oh, your favourite subject in school is ") + (fsubject) + (", my favourite subject in school is ") + (msubject))
  29.  
  30. print("ok, I gotta go now")
  31. print(("Bye ") + (first_name))
  32. robot_wait()
  33.  
  34. def robo_speech():
  35. from gtts import gTTS
  36. import os
  37. from datetime import datetime
  38. import time
  39.  
  40. spech = input("What do you want me to say?")
  41. tts = gTTS(text=spech, lang='en')
  42. tts.save("good.mp3")
  43. print("please wait.. loading")
  44. time.sleep(10)
  45.  
  46. # Fibonacci series
  47. def robot_fib():
  48.  
  49. n = input("Enter a number: ")
  50. a = 0
  51. b = 1
  52. fibnum = [0,1]
  53.  
  54. count = 2
  55. while count < int(n):
  56. c = (a + b)
  57. count += 1
  58. fibnum.insert(count,c)
  59. a = b
  60. b = c
  61. j = 0
  62. for num in fibnum:
  63. j += 1
  64. print(str(j), "-> ", num)
  65. robot_wait()
  66.  
  67. def robot_dice():
  68. import random
  69. print(random.randint(1,6))
  70. import os
  71. e = input("Do you want to roll again.. press 'Y' to continue: ")
  72. os.system('clear')
  73. if (e =='Y') or (e == 'y'):
  74. robot_dice()
  75.  
  76. def chat():
  77. print("Welcome to Chat Room \n")
  78. robot_chat()
  79.  
  80. def speech():
  81. print("Welcome to Robo Talk \n")
  82. robo_speech()
  83. robot_wait()
  84.  
  85. def fibonaccinums():
  86. print("Welcome to Fibonacci Series Center \n")
  87. robot_fib()
  88.  
  89. def dice():
  90. print("Welcome to Dice Table \n")
  91. robot_dice()
  92.  
  93. def guide():
  94. print("Help Page: \n")
  95. print("1. In Chat, you can chat with a robot")
  96. print("2. In Speech, you enter a saying and then a robot says it")
  97. print("3.In Fibonnacci Numbers, you can find out numbers of fibonnacci")
  98. print("4.In Dice, you can generate a random number between 1 through 6")
  99. robot_wait()
  100.  
  101. def exit():
  102. import os
  103. e = input("Are you sure you want to exit.. press 'Y' to exit: ")
  104. os.system('clear')
  105. if (e =='Y') or (e == 'y'):
  106. ("Good Bye.. exiting Robo meet., see you again")
  107. quit()
  108.  
  109. def printOptions():
  110. print("Welcome to Robot Sarvesh...\n")
  111. print("1. Chat")
  112. print("2. Speech")
  113. print("3. Fibonacci Numbers")
  114. print("4. Dice")
  115. print("5. Help")
  116. print("6. Exit")
  117.  
  118.  
  119.  
  120. def robot_main():
  121. import os
  122.  
  123. os.system('clear')
  124. printOptions()
  125. argument = input ("Enter your option: ")
  126. os.system('clear')
  127. if (argument == "1"):
  128. chat()
  129. elif (argument == "2"):
  130. speech()
  131. elif (argument == "3"):
  132. fibonaccinums()
  133. elif (argument == "4"):
  134. dice()
  135. elif (argument == "5"):
  136. guide()
  137. elif (argument == "6"):
  138. exit()
  139.  
  140.  
  141. while(1):
  142. robot_main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement