Advertisement
soheil_bozorgkhou

K&S Program v1.3

Jul 28th, 2017
436
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 36.68 KB | None | 0 0
  1. #in the name of GOD
  2. #For Using This Program You Need "wget","talkey","copypaste","vocabulary" and "mss" libraries
  3.  
  4. from mss import mss
  5. from vocabulary.vocabulary import Vocabulary as vb
  6. from google import search
  7. import math
  8. import time
  9. import requests
  10. import wget
  11. import random
  12. import urllib.request
  13. import socket
  14. import urllib
  15. from copypaste import copy, paste
  16. import sys
  17.  
  18.  
  19. def is_number(s):
  20.      try:
  21.          float(s)
  22.          return True
  23.        
  24.      except:
  25.          return False
  26.  
  27.  
  28. def ttss():
  29.      try:          
  30.           import talkey
  31.           tts = talkey.Talkey(
  32.                         engine_preference=['espeak'],
  33.                        
  34.                         espeak={
  35.  
  36.                             'options': {
  37.                                 'enabled': True,
  38.                             },
  39.  
  40.  
  41.                             'defaults': {
  42.                                     'words_per_minute': 183,
  43.                                    
  44.                             },
  45.  
  46.                          
  47.                             'languages': {
  48.                                 'en': {
  49.                                     'voice': 'english-mb-en1',
  50.                                     'words_per_minute': 183
  51.                                 },
  52.                             }
  53.                         }
  54.                     )
  55.           return True
  56.  
  57.  
  58.      
  59.      except:
  60.           return False
  61.  
  62. def is_downloadable(url):
  63.     """
  64.    Does the url contain a downloadable resource
  65.    """
  66.     h = requests.head(url, allow_redirects=True)
  67.     header = h.headers
  68.     content_type = header.get('content-type')
  69.     if 'text' in content_type.lower():
  70.         return False
  71.     if 'html' in content_type.lower():
  72.         return False
  73.     return True
  74.  
  75.      
  76.  
  77. def isdl(url):
  78.      
  79.           if is_downloadable(url) == True:
  80.                return True
  81.           else:
  82.                return False
  83.  
  84.  
  85. gel = ttss()
  86. if gel == True:
  87.                import talkey
  88.                tts = talkey.Talkey(
  89.                        
  90.  
  91.                         engine_preference=['espeak'],
  92.                        
  93.                         espeak={
  94.  
  95.                             'options': {
  96.                                 'enabled': True,
  97.                             },
  98.  
  99.  
  100.                             'defaults': {
  101.                                     'words_per_minute': 183,
  102.                                    
  103.                             },
  104.  
  105.                          
  106.                             'languages': {
  107.                                 'en': {
  108.                                     'voice': 'english-mb-en1',
  109.                                     'words_per_minute': 183
  110.                                 },
  111.                             }
  112.                         }
  113.                     )
  114.  
  115.                count = 0
  116.                print ("Welcome To K&S Program\nFor Help Please Type \"help\" And For More Information Please Type \"credits\" Or \"license\"")  
  117.                tts.say("welcome to K and S program. for help please type help and for more information please type credits or license")
  118.  
  119.  
  120.                while count < 5:
  121.                      
  122.                   print ("==>")
  123.                   u = input ()
  124.  
  125.  
  126.  
  127.  
  128.                    
  129.                   if u == "download" or u == 'Download' or u == "DOWNLOAD":
  130.                    
  131.                      def internet():
  132.                               try:
  133.                                     urllib.request.urlopen ('http://ipecho.net/plain')
  134.                                     return True
  135.                               except:
  136.                                     return False
  137.                    
  138.                      def is_downloadable(url):
  139.                                        h = requests.head(url, allow_redirects=True)
  140.                                        header = h.headers
  141.                                        content_type = header.get('content-type')
  142.                                        if 'text' in content_type.lower():
  143.                                            return False
  144.                                        if 'html' in content_type.lower():
  145.                                            return False
  146.                                        return True
  147.  
  148.                      if internet() == True:                  
  149.                                print ("Please Enter The Download Link If You Copied The Download Link Please Type \"paste\":")
  150.                                tts.say ("Please Enter The Download Link If You Copied The Download Link Please Type paste")
  151.                                popp = input()
  152.                                if popp == 'paste' or popp == 'Paste':
  153.                                                  tt = paste()
  154.                                                  ff= str(tt)
  155.                                                  if is_downloadable(ff) == True:
  156.                                                      print ("Starting Download...")
  157.                                                      
  158.                                                      filename = wget.download(ff)
  159.                                                      print ("File Downloaded")
  160.                                                      
  161.                                                  else:
  162.                                                      print ("Your Download Link Is Incorrect")
  163.                                                      tts.say ("your download link is incorrect")
  164.                                else:
  165.                                                      
  166.                                                  ff= popp
  167.                                                  if is_downloadable(ff) == True:
  168.                                                      print ("Starting Download")
  169.                                                      
  170.                                                      filename = wget.download(ff)
  171.                                                      print ("File Downloaded")
  172.                              
  173.                                                  else:
  174.                                                      print ("Your Download Link Is Incorrect")
  175.                                                      tts.say ("your download link is incorrect")
  176.                            
  177.                      else:
  178.                         print ("You Are Not Connected To The Internet")
  179.                         tts.say("you are not connected to the internet")
  180.  
  181.  
  182.  
  183.                        
  184.                      
  185.                   elif u == 'source' or u == 'Source' or u == "SOURCE":
  186.                       print ("\nPlease Go To https://pastebin.com/veFRa685 To See The Source Code\n")
  187.  
  188.  
  189.                   elif u == "google" or u == 'Google' or u == 'Search' or u == "search":
  190.                       def internet():
  191.                               try:
  192.                                     urllib.request.urlopen ('http://ipecho.net/plain')
  193.                                     return True
  194.                               except:
  195.                                     return False
  196.                                    
  197.                       if internet() == False:
  198.                             print ("You Are Not Connected To The Internet")
  199.                             tts.say ("You Are Not Connected To The Internet")
  200.                       else:
  201.                                  print ("Please Enter The Text That You Want To Search:")
  202.                                  tts.say ('please enter the text that you want to search')
  203.                                  searchvar = input()
  204.                                  for url in search(searchvar, tld='com.pk', lang='es', stop=5):
  205.                                        print(url)
  206.                                  
  207.                      
  208.                   elif u == 'time' or u == 'Time' or u =="TIME":
  209.                      localtime = time.asctime( time.localtime(time.time()) )
  210.                      print ("Local current time :", localtime)
  211.                      tts.say("local current time is")
  212.                      tts.say (localtime)
  213.  
  214.  
  215.                   elif u == 'dic' or u == "dictionary":
  216.                         def internet():
  217.                                  try:
  218.                                          urllib.request.urlopen ('http://ipecho.net/plain')
  219.                                          return True
  220.                                  except:
  221.                                          return False
  222.                        
  223.                         if internet() == True:
  224.                            print ("Welcome To The Dictionary\nPlease Type \"syn\" For Synonym \nType \"mean\" For Meaning Of The Word\nType \"ant\" For Antonyms Of The Word\nAnd Type \"exa\" To See A Quick Example On How To Use The Word")
  225.                            print ("Please Type Your Command:")
  226.                            tts.say ("please enter your command")
  227.                            diccom = input ()
  228.                            if diccom == 'syn':
  229.                                 print ("Please Enter The Word:")
  230.                                 tts.say ("please enter the word")
  231.                                 dicword = input()
  232.                                 print (vb.synonym(dicword))
  233.                            elif diccom == 'mean':
  234.                                 print ("Please Enter The Word:")
  235.                                 tts.say ("please enter the word")
  236.                                 dicword = input()
  237.                                 print (vb.meaning(dicword))
  238.                            elif diccom == "ant":
  239.                                 print ("Please Enter The Word:")
  240.                                 tts.say ("please enter the word")
  241.                                 dicword = input()
  242.                                 print (vb.antonym(dicword))
  243.                            elif diccom == "exa":
  244.                                 print ("Please Enter The Word:")
  245.                                 tts.say ("please enter the word")
  246.                                 dicword = input()
  247.                                 print (vb.usage_example(dicword))
  248.                            else:
  249.                                 print ("Your Command Is Incorrect")
  250.                                 tts.say ("your command is incorrect")
  251.  
  252.                         elif internet() == False:
  253.                            print ("You Are Not Connected To The Internet")
  254.                            tts.say ("you are not connected to the internet")
  255.  
  256.  
  257.  
  258.                   elif u == 'game' or u == 'Game' or u == "GAME":
  259.                         ii =random.randint(1,10)
  260.                         print("Welcome To The Guess The Number Game\nYou Should Guess A Number Between 1 And 10\n You Have 3 Chances To Guess\n")
  261.                         tts.say ("welcome to guess the number game you should guess a number between 1 and 10 you have three chances to guess")
  262.                         print ("Please Enter Your First Guess:")
  263.                         tts.say ("please type your first guess")
  264.                         pp = input()
  265.                         if is_number(pp) == True:
  266.                            
  267.                                  if int(pp) == int(ii):
  268.                                       print("Excellent You Won!!!!!\n")
  269.                                       tts.say ("excellent you won")
  270.                                  else:
  271.                                       if int(pp) > int(ii):
  272.                                                 print ("Your Nmuber Is Greater Than Our Number")
  273.                                                 tts.say ("your number is greater than our number")
  274.                                       else:
  275.                                            print ("Your Number Is Smaller Than Our Number")
  276.                                            tts.say ("your number is smaller than our number")
  277.                                       print ("Please Enter Your Second Guess:")
  278.                                       tts.say ("please enter your second guess")
  279.                                       oo = input()
  280.                                       if is_number(oo) == True:
  281.                                             if int(oo) == int(ii):
  282.                                                 print ("Excellent You Won!!!!!!!\n")
  283.                                                 tts.say ("excellent you won")
  284.                                             else:
  285.                                                       if int(oo) > int (ii):
  286.                                                            print ("Your Nmuber Is Greater Than Our Number")
  287.                                                            tts.say ("your number is greater than our number")
  288.                                                       else:
  289.                                                            print ("Your Number Is Smaller Than Our Number")
  290.                                                            tts.say ("your number is smaller than our number")
  291.                                                       print ("Please Enter Your Last Guess:")
  292.                                                       tts.say ("please enter your last guess")
  293.                                                       uuu = input()
  294.                                                       if is_number (uuu) == True:  
  295.                                                             if int(uuu) == ii:
  296.                                                                       print ("Excellent You Won!!!!!!\n")
  297.                                                                       tts.say ("excellent you won")
  298.                                                             else:
  299.                                                                       print ("GAME OVER!!!")
  300.                                                                       tts.say ("game over")
  301.                                                                       print ("The Number Was",ii)
  302.                                                                       tts.say ("the number was")
  303.                                                                       tts.say (str (ii))
  304.                                                       else:
  305.                                                          print ("Please Enter A Number And Nothing Else")
  306.                                                          tts.say ("please enter a number and nothing else")
  307.                                       else:
  308.                                          print ("Please Enter A Number And Nothing Else")
  309.                                          tts.say ("please enter a number and nothing else")
  310.                         else:
  311.                            print ("Please Enter A Number And Nothing Else")
  312.                            tts.say ("please enter a number and nothing else")
  313.  
  314.  
  315.                            
  316.  
  317.                   elif u == "convert" or u == "Convert" or u == 'CONVERT':
  318.                      print ("\nPlease Type \"c\" For Converting Centigrade To Fahrenheit And Type \"f\" For Conerting Fahrenheit To Centigrade:")
  319.                      tts.say("please type C for converting centigrade to fahrenheit and type F for converting fahrenheit to centigrade")
  320.                      con = input()
  321.                      if con == 'c' or con == "C":
  322.                         print ("Please Enter The Number:")
  323.                         tts.say ("Please Enter The Number")
  324.                         tobe = input()
  325.                         if is_number(tobe) == True:
  326.                               iu = int(tobe)*1.8+32
  327.                               print (tobe,"Centigrade = ",iu,"Fahrenheit")
  328.                               tts.say(str(tobe))
  329.                               tts.say("Centigrade")
  330.                               tts.say("Is equal to")
  331.                               tts.say(str(iu))
  332.                               tts.say("fahrenheit")
  333.                         else:
  334.                             print("Please Enter A Number And Nothing Else")
  335.                             tts.say("please enter a number and nothing else")
  336.                  
  337.                      elif con == 'f' or con == "F":
  338.                         print ("Please Enter The Number:")
  339.                         tts.say("Please Enter The Number:")
  340.                         tobe = input()
  341.                         if is_number(tobe) == True:
  342.                               iu = (int(tobe)-32)/8
  343.                               print (tobe,"Fahrenheit = ",iu,"Centigrade")
  344.                               tts.say(str(tobe))
  345.                               tts.say("fahrenheit")
  346.                               tts.say("Is equal to")
  347.                               tts.say(str(iu))
  348.                               tts.say("centigrade")
  349.                         else:
  350.                             print("Please Enter A Number And Nothing Else")
  351.                             tts.say("please enter a number and nothing else")      
  352.                      else:
  353.                         print ("Your Command Is Incorrect")
  354.                         tts.say("your command is incorrect")
  355.  
  356.  
  357.  
  358.                        
  359.                        
  360.                   elif u == 'tts' or u == "Tts" or u == "TTS":
  361.                      ttsvar = input ("Please Enter Your Text:")      
  362.                      tts.say(ttsvar)
  363.  
  364.  
  365.                   elif u == "screenshot" or u == 'scrshot' or u == 'Screenshot' or u == 'SCREENSHOT' or u == "Scrshot" or u == 'SCRSHOT':
  366.                     with mss() as sct:
  367.                        sct.shot()
  368.                        print ("The Screenshot Picture Saved")
  369.                        tts.say ("the screenshot picture saved")
  370.  
  371.                   elif u == "credits":
  372.                       print ("\n2016-2017 Soheil And Kamyar\nsoheilmokhe@gmail.com\n")
  373.                       tts.say ("Soheil And Kamyar")
  374.  
  375.                      
  376.                      
  377.                   elif u == "help" or u == 'Help' or u == 'HELP':
  378.                       print ("\nTo Run Calculator Please Type \"calc\"\nTo See Credits Type \"credits\"\nTo See The Local Current Time Please Type \"time\"\nTo Downlaod Something Via K&S Please Type \"download\"\nTo See The Source Code Please Type \"source\"\nTo Use The Text To Speech Please Type \"tts\"")
  379.                       print ("To Use Convert Tool To Convert Centigrade To Fahrenheit Or Fahrenheit To Centigrade Please Type \"convert\"")
  380.                       print ("To Use The Google Search Tool Please Type \"search\"")
  381.                       print ("To Take A Screen Shot From Your Desktop Please Type \"scrshot\"")
  382.                       print ('To Run Guess The Number Game Please Type \"game\"')
  383.                       print ("For Using Dictionary Please Type \"dic\"")
  384.                       print ("To See Your Public IP Address Please Type \"ip\"\nTo Close The Program Please Type \"close\"\n")
  385.                      
  386.  
  387.  
  388.                   elif u == 'close' or u == "Close" or u == "CLOSE":
  389.                      exit()
  390.  
  391.  
  392.                                  
  393.  
  394.                   elif u == 'ip' or u == 'IP' or u == "Ip":
  395.                      def internet():
  396.                               try:
  397.                                   urllib.request.urlopen ("http://ipecho.net/plain")
  398.                                   return True
  399.                               except:
  400.                                   return False
  401.                      
  402.                      if internet() == True:
  403.                         fp = urllib.request.urlopen("http://ipecho.net/plain")
  404.                         mybytes = fp.read()
  405.                         mystr = mybytes.decode("utf8")
  406.                         fp.close()
  407.                         print("\nYour Public IP Address:",mystr)
  408.                         tts.say("your public i p address is")
  409.                         tts.say(mystr)
  410.                      else:
  411.                         print("You Are Not Connected To The Internet")
  412.                         tts.say("you are not connected to the internet")
  413.  
  414.  
  415.  
  416.                        
  417.                   elif u == "license":
  418.                      print ("You Can Do Whatever You Want  With This Program And Its Sourcecode :D")
  419.                      tts.say ("you can do whatever you want with this program and its source code")
  420.  
  421.  
  422.  
  423.                   elif u == "calc" or u == 'Calc' or u == "CALC":
  424.                       print ("\nCalculator Version 1.0\nPlease Enter Your Operator (+,-,/,*,**,#,cos,sin,tan,acos,acosh,asin,atan,ceil,floor,factorial) :")
  425.                       tts.say("Please Type Your Operator")
  426.                       x = input()
  427.                       if x == '+':
  428.                            print ("Please Enter Your First Number:")            
  429.                            tts.say("Please enter your first number")
  430.                            y = input()
  431.                            if is_number(y) == True:
  432.                              
  433.                                print ("Please Enter Your Second Number:")            
  434.                                tts.say("Please enter your second number")
  435.                                z = input ()
  436.                                if is_number(z) == True:
  437.                                  
  438.                                    c = int(y) + int(z)
  439.                                    print ("Your Number Is:",c)          
  440.                                    tts.say("your number is")
  441.                                    tts.say (str(c))
  442.                                else:
  443.                                   print("Please Enter A Number And Nothing Else")
  444.                                   tts.say("please enter a number and nothing else")
  445.                                
  446.  
  447.                            else:
  448.                               print("Please Enter A Number And Nothing Else")
  449.                               tts.say("please enter a number and nothing else")
  450.                              
  451.                       elif x == '-':
  452.                            print ("Please Enter Your First Number:")            
  453.                            tts.say("Please enter your first number")
  454.                            y = input()
  455.                            if is_number(y) == True:
  456.                              
  457.                                print ("Please Enter Your Second Number:")            
  458.                                tts.say("Please enter your second number")
  459.                                z = input ()
  460.                                if is_number(z) == True:
  461.                                    c = int(y) - int(z)
  462.                                    print ("Your Number Is:",c)          
  463.                                    tts.say("your number is")
  464.                                    tts.say (str(c))
  465.                                else:
  466.                                   print("Please Enter A Number And Nothing Else")
  467.                                   tts.say("please enter a number and nothing else")
  468.                                
  469.  
  470.                            else:
  471.                               print("Please Enter A Number And Nothing Else")
  472.                               tts.say("please enter a number and nothing else")
  473.                            
  474.                       elif x == '*':
  475.                            print ("Please Enter Your First Number:")            
  476.                            tts.say("Please enter your first number")
  477.                            y = input()
  478.                            if is_number(y) == True:
  479.                              
  480.                                print ("Please Enter Your Second Number:")            
  481.                                tts.say("Please enter your second number")
  482.                                z = input ()
  483.                                if is_number(z) == True:
  484.                                    c = int(y) * int(z)
  485.                                    print ("Your Number Is:",c)          
  486.                                    tts.say("your number is")
  487.                                    tts.say (str(c))
  488.                                else:
  489.                                   print("Please Enter A Number And Nothing Else")
  490.                                   tts.say("please enter a number and nothing else")
  491.                                
  492.  
  493.                            else:
  494.                               print("Please Enter A Number And Nothing Else")
  495.                               tts.say("please enter a number and nothing else")
  496.                            
  497.                       elif x == '/':
  498.                            print ("Please Enter Your First Number:")            
  499.                            tts.say("Please enter your first number")
  500.                            y = input()
  501.                            if is_number(y) == True:
  502.                              
  503.                                print ("Please Enter Your Second Number:")            
  504.                                tts.say("Please enter your second number")
  505.                                z = input ()
  506.                                if is_number(z) == True:
  507.                                    c = int(y) / int(z)
  508.                                    print ("Your Number Is:",c)          
  509.                                    tts.say("your number is")
  510.                                    tts.say (str(c))
  511.                                else:
  512.                                   print("Please Enter A Number And Nothing Else")
  513.                                   tts.say("please enter a number and nothing else")
  514.                                
  515.  
  516.                            else:
  517.                               print("Please Enter A Number And Nothing Else")
  518.                               tts.say("please enter a number and nothing else")
  519.                            
  520.                       elif x == '#':
  521.                            print ("Please Enter Your Number:")            
  522.                            tts.say("Please Enter your number")
  523.                            y = input()
  524.                            if is_number(y) == True:
  525.                               z = int (y)
  526.                               c = math.sqrt (z)
  527.                               print ("Your Number Is:",c)
  528.                               tts.say("your number is")
  529.                               tts.say (str(c))
  530.                            else:
  531.                               print("Please Enter A Number And Nothing Else")
  532.                               tts.say("please enter a number and nothing else")
  533.                            
  534.                       elif x == '**':
  535.                            print ("Please Enter Your First Number:")            
  536.                            tts.say("Please enter your first number")
  537.                            y = input()
  538.                            if is_number(y) == True:
  539.                              
  540.                                print ("Please Enter Your Second Number:")            
  541.                                tts.say("Please enter your second number")
  542.                                z = input ()
  543.                                if is_number(z) == True:
  544.                                    c = int(y) ** int(z)
  545.                                    print ("Your Number Is:",c)          
  546.                                    tts.say("your number is")
  547.                                    tts.say (str(c))
  548.                                else:
  549.                                   print("Please Enter A Number And Nothing Else")
  550.                                   tts.say("please enter a number and nothing else")
  551.                            else:
  552.                               print("Please enter a number and nothing else")
  553.                               tts.say("please enter a number and nothing else")
  554.                              
  555.                       elif x == 'cos':
  556.                            print ("Please Enter Your Number:")            
  557.                            tts.say("Please Enter your number")
  558.                            y = input()
  559.                            if is_number(y) == True:
  560.                               z = int (y)
  561.                               c = math.cos(z)
  562.                               print ("Your Number Is:",c)
  563.                               tts.say("your number is")
  564.                               tts.say (str(c))
  565.                            else:
  566.                               print("Please Enter A Number And Nothing Else")
  567.                               tts.say("please enter a number and nothing else")
  568.                              
  569.                       elif x == "sin":
  570.                            print ("Please Enter Your Number:")            
  571.                            tts.say("Please Enter your number")
  572.                            y = input()
  573.                            if is_number(y) == True:
  574.                               z = int (y)
  575.                               c = math.sin(z)
  576.                               print ("Your Number Is:",c)
  577.                               tts.say("your number is")
  578.                               tts.say (str(c))
  579.                            else:
  580.                               print("Please Enter A Number And Nothing Else")
  581.                               tts.say("please enter a number and nothing else")
  582.  
  583.                       elif x == 'tan':
  584.                            print ("Please Enter Your Number:")            
  585.                            tts.say("Please Enter your number")
  586.                            y = input()
  587.                            if is_number(y) == True:
  588.                               z = int (y)
  589.                               c = math.tan(z)
  590.                               print ("Your Number Is:",c)
  591.                               tts.say("your number is")
  592.                               tts.say (str(c))
  593.                            else:
  594.                               print("Please Enter A Number And Nothing Else")
  595.                               tts.say("please enter a number and nothing else")
  596.                              
  597.                       elif x == 'acos':
  598.                            print ("Please Enter Your Number:")            
  599.                            tts.say("Please Enter your number")
  600.                            y = input()
  601.                            if is_number(y) == True:
  602.                               z = int (y)
  603.                               c = math.acos(z)
  604.                               print ("Your Number Is:",c)
  605.                               tts.say("your number is")
  606.                               tts.say (str(c))
  607.                            else:
  608.                               print("Please Enter A Number And Nothing Else")
  609.                               tts.say("please enter a number and nothing else")
  610.                              
  611.                       elif x == 'acosh':
  612.                            print ("Please Enter Your Number:")            
  613.                            tts.say("Please Enter your number")
  614.                            y = input()
  615.                            if is_number(y) == True:
  616.                               z = int (y)
  617.                               c = math.acosh(z)
  618.                               print ("Your Number Is:",c)
  619.                               tts.say("your number is")
  620.                               tts.say (str(c))
  621.                            else:
  622.                               print("Please Enter A Number And Nothing Else")
  623.                               tts.say("please enter a number and nothing else")
  624.                              
  625.                       elif x == 'asin':
  626.                            print ("Please Enter Your Number:")            
  627.                            tts.say("Please Enter your number")
  628.                            y = input()
  629.                            if is_number(y) == True:
  630.                               z = int (y)
  631.                               c = math.asin(z)
  632.                               print ("Your Number Is:",c)
  633.                               tts.say("your number is")
  634.                               tts.say (str(c))
  635.                            else:
  636.                               print("Please Enter A Number And Nothing Else")
  637.                               tts.say("please enter a number and nothing else")
  638.                              
  639.                       elif x == 'atan':
  640.                            print ("Please Enter Your Number:")            
  641.                            tts.say("Please Enter your number")
  642.                            y = input()
  643.                            if is_number(y) == True:
  644.                               z = int (y)
  645.                               c = math.atan(z)
  646.                               print ("Your Number Is:",c)
  647.                               tts.say("your number is")
  648.                               tts.say (str(c))
  649.                            else:
  650.                               print("Please Enter A Number And Nothing Else")
  651.                               tts.say("please enter a number and nothing else")
  652.                              
  653.                       elif x == 'ceil':
  654.                            print ("Please Enter Your Number:")            
  655.                            tts.say("Please Enter your number")
  656.                            y = input()
  657.                            if is_number(y) == True:
  658.                               z = int (y)
  659.                               c = math.ceil(z)
  660.                               print ("Your Number Is:",c)
  661.                               tts.say("your number is")
  662.                               tts.say (str(c))
  663.                            else:
  664.                               print("Please Enter A Number And Nothing Else")
  665.                               tts.say("please enter a number and nothing else")
  666.                              
  667.                       elif x == 'factorial':
  668.                            print ("Please Enter Your Number:")            
  669.                            tts.say("Please Enter your number")
  670.                            y = input()
  671.                            if is_number(y) == True:
  672.                               z = int (y)
  673.                               c = math.factorial(z)
  674.                               print ("Your Number Is:",c)
  675.                               tts.say("your number is")
  676.                               tts.say (str(c))
  677.                            else:
  678.                               print("Please Enter A Number And Nothing Else")
  679.                               tts.say("please enter a number and nothing else")
  680.                              
  681.                       elif x == 'floor':
  682.                            print ("Please Enter Your Number:")            
  683.                            tts.say("Please Enter your number")
  684.                            y = input()
  685.                            if is_number(y) == True:
  686.                               z = int (y)
  687.                               c = math.floor(z)
  688.                               print ("Your Number Is:",c)
  689.                               tts.say("your number is")
  690.                               tts.say (str(c))
  691.                            else:
  692.                               print("Please Enter A Number And Nothing Else")
  693.                               tts.say("please enter a number and nothing else")
  694.                              
  695.                       else :
  696.                            print ("Your Operator Is Incorrect")
  697.                            tts.say("your operator is incorrect")
  698.  
  699.                  
  700.  
  701.                   else :
  702.                      print ("I Think Your Command Is Incorrect For Help Please Type \"help\"")
  703.                      tts.say("I Think Your Command Is Incorrect For Help Please Type help.")
  704.  
  705. elif gel == False:
  706.      def internet():
  707.              try:
  708.                      urllib.request.urlopen ("http://ipecho.net/plain")
  709.                      return True
  710.              except:
  711.                      return False
  712.      print ("ERORR:For Using This Program You Need To Have A Text To Speech Engine Like eSpeak\nIf You Are A Linux User You Can Download And Install eSpeak By This Command:\nsudo apt-get install espeak")
  713.      print ( "If You Are A Windows User You Can Download eSpeak From http://espeak.sourceforge.net/download.html \nOr You Can Download eSpeak From This Program (2.5 MBytes)\nDo You Want Download eSpeak From This Program (y/n)?:")
  714.      pof = input()
  715.      if pof == 'y' or pof == 'Y':
  716.             if internet() == True:
  717.                       print ("Starting Download..")
  718.                       print ("Downloading File....")
  719.                       hh = "http://s9.picofile.com/d/8301732550/64adee64-fe5c-47e6-9096-feb4f227ad0c/setup_espeak_1_48_04.exe"
  720.                       file_url = wget.download (hh)
  721.                       print ("The setup_espeak-1.48.04.exe File Downloaded. Please Run And Install Downloded File And Reopen The K&S Program")
  722.                       doncomp = input()
  723.             else:
  724.                  print ("You Are Not Connected To The Internet.Please Connect To The Internet To Download The File")
  725.                  ops = input()
  726.                      
  727.      else:
  728.             exit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement