Advertisement
GameNationRDF

Website & File Launcher + Calculator version 0.0.8

Sep 15th, 2013
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.80 KB | None | 0 0
  1. #Python Launcher version 0.0.8
  2. #Coded by GameNationRDF
  3. #It will be updated frequently with bug fixes and new feautures!
  4. import webbrowser
  5. import sys
  6. import os
  7. import string
  8. import time
  9. import math
  10.  
  11. def blank():
  12.     print (" ")
  13.  
  14. def intro():
  15.     print ("Here are the things you can do: ")
  16.     blank()
  17.     print ("    *Type the website and hit enter to launch that website!")
  18.     blank()
  19.     print ("    *Type 'file', and write the location of a file/program to launch it!")
  20.     blank()
  21.     print ("    *Type 'exit' to close the program!")
  22.     blank()
  23.     print ("    *Type 'math' to do basic math operations!")
  24.     blank()
  25.    
  26. intro()
  27.    
  28. while True:
  29.     userIn=str(input("Enter address/command here: "))
  30.     blank()
  31.     if userIn == ("exit"):
  32.         print ("Program will close in a second..")
  33.         time.sleep(1)
  34.         sys.exit()
  35.     elif userIn == ("file"):
  36.         filename=str(input("    *Enter file place: "))
  37.         os.system("start "+filename)
  38.     elif userIn.startswith("www") is True:
  39.         handle=webbrowser.get()
  40.         handle.open(userIn)
  41.     elif userIn == ("math"):
  42.  
  43.         operation = str(input("Enter operation (+, -, *, /, sqrt, exp): "))
  44.         blank()
  45.        
  46.         if operation == ("+"):
  47.             input_1 = int(input("   *Enter first number:  "))
  48.             input_2 = int(input("   *Enter second number: "))
  49.             print ((input_1)+(input_2))
  50.             blank()
  51.         elif operation == ("-"):
  52.             input_1 = int(input("   *Enter first number:  "))
  53.             input_2 = int(input("   *Enter second number: "))
  54.             print ((input_1)-(input_2))
  55.             blank()
  56.         elif operation == ("*"):
  57.             input_1 = int(input("   *Enter first number:  "))
  58.             input_2 = int(input("   *Enter second number: "))
  59.             print ((input_1)*(input_2))
  60.             blank()
  61.         elif operation == ("/"):
  62.             input_1 = int(input("   *Enter first number:  "))
  63.             input_2 = int(input("   *Enter second number: "))
  64.             print ((input_1)/(input_2))
  65.             blank()
  66.         elif operation == ("exp"):
  67.             input_1 = int(input("   *Enter first number:  "))
  68.             input_2 = int(input("   *Enter second number: "))
  69.             print ((input_1)**(input_2))
  70.             blank()
  71.         elif operation == ("sqrt"):
  72.             oneInput = int(input("  *Enter number: "))
  73.             print (math.sqrt(oneInput))
  74.             blank()
  75.     else:
  76.         print ("Sorry, unknown command!")
  77.         blank()
  78.  
  79.  
  80. #Changelog:
  81.         # -Very quick update: Exponents added!
  82.        
  83.  
  84. #Other changes from 0.0.7:
  85.        
  86.         # -Math operators added :) .
  87.         # -Overhauled code! (made everything better :D)
  88.         # -Again, better UI.
  89.         # -More operations and file shortcuts coming soon!
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement