Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #default imports
- import os #OS, for Windows version!
- import time
- #default variables
- welcome = 'welcome to CLI'
- hello = 'hello'
- #clear the screen
- def cleardef():
- os.system('cls')
- #type2continue prompt
- def type2conti():
- uselessvar = input('type something to continue..')
- cli()
- def wwhat():
- print('test')
- cli()
- #CLI
- def cli():
- cleardef()
- global command
- print(welcome)
- #ERROR
- #---------------------------------------
- #take away the # to see the random error
- #print(hello)
- #---------------------------------------
- time.sleep(0.1)
- command = input('type your command>>> ')
- if command == 'change welcome':
- #changewelcome
- def changewelcome():
- global welcome
- welcome = input('what would you like your welcome message to be?>>> ')
- changewelcome()
- cli()
- #about
- elif command == 'about':
- cleardef()
- print("tbh pretty useless")
- time.sleep(1)
- cli()
- #calculator
- elif command == 'calculator':
- #setting a calculator def so it can run back if the "if" statement runs else
- def calculatordef():
- global firstn
- global secondn
- global sign
- firstn = int(input('first number>>> '))
- secondn = int(input('second number>>> '))
- sign = input('sign>>> ')
- calculatordef()
- if sign == '+':
- number = firstn + secondn
- print(number)
- type2conti()
- elif sign == '-':
- number = firstn - secondn
- print(number)
- type2conti()
- elif sign == '*':
- number = firstn * secondn
- print(number)
- type2conti()
- cli()
- if sign == '/':
- number = firstn / secondn
- print(number)
- type2conti()
- else:
- #invalid signs for calculator
- print('"',sign,'"', 'invald sign')
- time.sleep(1)
- type2conti()
- #if the user types anything else..
- else:
- print('"',command,'"', 'invalid command')
- type2conti()
- cli()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement