Advertisement
Fluffyofqweam

Untitled

Apr 29th, 2018
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.83 KB | None | 0 0
  1. #default imports
  2. import os #OS, for Windows version!
  3. import time
  4. #default variables
  5. welcome = 'welcome to CLI'
  6. hello = 'hello'
  7. #clear the screen
  8. def cleardef():
  9.     os.system('cls')
  10. #type2continue prompt
  11. def type2conti():
  12.     uselessvar = input('type something to continue..')
  13.     cli()
  14. def wwhat():
  15.     print('test')
  16.     cli()
  17. #CLI
  18. def cli():
  19.     cleardef()
  20.     global command
  21.     print(welcome)
  22.     #ERROR
  23.     #---------------------------------------
  24.     #take away the # to see the random error
  25.     #print(hello)
  26.     #---------------------------------------
  27.     time.sleep(0.1)
  28.     command = input('type your command>>> ')
  29.     if command == 'change welcome':
  30.         #changewelcome
  31.         def changewelcome():
  32.             global welcome
  33.             welcome = input('what would you like your welcome message to be?>>> ')
  34.         changewelcome()
  35.         cli()
  36.         #about
  37.     elif command == 'about':
  38.         cleardef()
  39.         print("tbh pretty useless")
  40.         time.sleep(1)
  41.         cli()
  42.     #calculator
  43.     elif command == 'calculator':
  44.         #setting a calculator def so it can run back if the "if" statement runs else
  45.         def calculatordef():
  46.             global firstn
  47.             global secondn
  48.             global sign
  49.             firstn = int(input('first number>>> '))
  50.             secondn = int(input('second number>>> '))
  51.             sign = input('sign>>> ')
  52.         calculatordef()
  53.         if sign == '+':
  54.             number = firstn + secondn
  55.             print(number)
  56.             type2conti()
  57.         elif sign == '-':
  58.             number = firstn - secondn
  59.             print(number)
  60.             type2conti()
  61.         elif sign == '*':
  62.             number = firstn * secondn
  63.             print(number)
  64.             type2conti()
  65.             cli()
  66.         if sign == '/':
  67.             number = firstn / secondn
  68.             print(number)
  69.             type2conti()
  70.         else:
  71.             #invalid signs for calculator
  72.             print('"',sign,'"', 'invald sign')
  73.             time.sleep(1)
  74.             type2conti()
  75.     #if the user types anything else..
  76.     else:
  77.         print('"',command,'"', 'invalid command')
  78.         type2conti()
  79. cli()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement