This is a follow up to the questions: PyDOS shell simulation PyDOS shell simulation and PyDOS: Version 2.0 PyDOS: Version 2.0
This is a follow up to the questions: PyDOS shell simulation and PyDOS: Version 2.0
This is a follow up to the questions: PyDOS shell simulation and PyDOS: Version 2.0
Updated - 01/05/15or05/01/15Depending where you are.
Whats New?
- Code updated
- About app now added.
- PyWrite under construction, therefore it has been removed from the home screen.
#PyDOS Version 3.0 - Written by Mrfunny744
import time
import os
import sys
import random
def ChangeName(): #Change your display name
os.system('cls' if os.name == 'nt' else 'clear')
print ("----------------------------------------------")
name = input ("Type in your new username: ")
print()
print ("This can be changed again if you wish.")
print ("----------------------------------------------")
time.sleep(2.5)
def shutdown(): #Shutting down PyDOS
print ("------------------------")
print ("| |")
print ("| Thank you for using |")
print ("| PyDOS |")
print ("| |")
print ("| |")
print ("| |")
print ("| Shutting Down... |")
print ("| |")
print ("------------------------")
sys.exit(0)
def end_simple_calcend():
simplecalcprint ("------------------------------------")
def end_calc print ("| |"):
print ("Thank"| you Thanks for using SimpleCalc"SimpleCalc! |")
print ("| |")
print ("------------------------------------")
time.sleep(2)
def calccalc_a(operation, num1, num2): #Operation System for SimpleCalc
if operation ==print 'a':("----------------------------------")
return num1 + num2
elif= operationint(input("Enter ==a 's'number: "))
return num1 - num2 elif= operationint(input("Enter ==a 'm'number: return num1 * num2"))
elif operation ==print 'd':("----------------------------------")
if num2answer === 0:num1+num2
raiseprint ValueError('Divide"Your byanswer 0is:" expection',answer)
return num1 /print num2("----------------------------------")
else:time.sleep(3)
raise ValueErrorend('Unknown error')
def simplecalc(): #Main screen for SimpleCalc
print ("----------------------------------------------------------")
print ("|Welcome to SimpleCalc! You have the following operators:|")
print ("|A: Add |")
print ("|S: Subtract |")
print ("|M: Multiply |")
print ("|D: Divide |")
print ("|Q: Quit |")
print ("----------------------------------------------------------")
def calc_m():
choice print ("----------------------------------")
num1 = int(input("Enter a number: "))
num2 = int("Choiceinput("Enter a number: "))
print ("----------------------------------")
answer = num1*num2
print ("Your answer is:" ,answer)
print ("----------------------------------")
time.lowersleep(3)
end()[0]
def calc_s():
if choiceprint ==("----------------------------------")
'q' num1 = int(input("Enter a number: "))
num2 = int(input("Enter a end_simple_calcnumber: "))
print ("----------------------------------")
answer = num1-num2
return print ("Your answer is:" ,answer)
print ("----------------------------------")
time.sleep(3)
end()
def calc_d():
if choiceprint not("----------------------------------")
in "asmd" num1 = int(input("Enter a number: "))
num2 = int(input("Enter a number: "))
print ("Invalid"----------------------------------")
specification. answer = num1/num2
print ("Your answer is:" ,answer)
print ("----------------------------------")
end_simple_calctime.sleep(3)
end()
return
try:
num1 = int(input("Enter a number: "))
num2 = int(input("Enter a number: "))
print ("Your answer is:", calc(choice, num1, num2))
def simplecalc():
except ValueErrorprint as("--------------------------")
err print ("| |")
print ("| Welcome to SimpleCalc |")
print ("| |")
print ("| A = Add |")
print ("| M = Multiply |")
print ("| S = Subtract |")
print ("| D = Divide |")
print ("| Q = Quit |")
print ("| |")
print ("--------------------------")
print ("| |")
choice = input ("| Choice: |")
print ("| |")
print(err"--------------------------")
if choice == 'a':
calc_a()
elif choice == 'm':
calc_m()
elif choice == 's':
calc_s()
elif choice == 'd':
calc_d()
elif choice == 'q':
end()
else:
print ("Invalid specifacation.args")
end_calc()
def error_message(): #Shown if the app does not exist.
os.system('cls' if os.name == 'nt' else 'clear')
print ("----------------------")
print ("| Whoops! |")
print ("| |")
print ("| |")
print ("| It dosent look |")
print ("| like the app |")
print ("| exists. |")
print ("| |")
print ("|Check and try again.|")
print ("----------------------")
time.sleep(3)
def About(): #About App
print ("-------------------------------------------------------------")
print ("| About PyDOS |")
print ("| |")
print ("| Version: 3.0 (Alpha 1.3) |")
print ("| |")
print ("| Dev Code: 47329257945 |")
print ("| |")
print ("| Serial Key: 357-494-626-181 |")
print ("| |")
print ("| |")
print ("| |")
print ("| |")
print ("| |")
print ("| |")
print ("| |")
print ("| Thanks for using PyDOS! |")
print ("-------------------------------------------------------------")
print ("| |")
print ("| Please press enter to close app |")
print ("| |")
print ("-------------------------------------------------------------")
input()
os.system('cls' if os.name == 'nt' else 'clear') #This is the startup screen. It only appears once beacuse of the While loop below.
print ("---------------------------")
print ("| |")
print ("| |")
print ("| Welcome to PyDOS! |")
print ("| |")
print ("| |")
print ("| |")
print ("| |")
print ("| |")
print ("| Version 3.0 |")
print ("| Alpha Edition |")
print ("| |")
print ("| |")
print ("---------------------------")
time.sleep(3)
print ()
print ("-----------------------------------------------")
name = input ("Enter a name: ")
print ("-----------------------------------------------")
print ("Information has been saved.")
print ()
print ("This data will be used in some applications.")
print ("-----------------------------------------------")
time.sleep(3)
while True: #This is the home screen
os.system('cls' if os.name == 'nt' else 'clear')
print ("-------------------------")
print ("| |")
print ("| |")
print ("| Loading Home |")
print ("| Screen |")
print ("| |")
print ("| |")
print ("| |")
print ("| |")
print ("| |")
print ("-------------------------")
time.sleep(1.5)
os.system('cls' if os.name == 'nt' else 'clear')
print ("-------------------------------------------------------------------------------")
print ("| Username:",name," |")
print ("-------------------------------------------------------------------------------")
print ("| |")
print ("| PyDOS Home Screen - Type in an app below. |")
print ("| |")
print ("| Apps: |")
print ("| |")
print ("| ChangeName |")
print ("| Shutdown |")
print ("| SimpleCalc |")
print ("| PyWrite |")
print ("| About |")
print ("| |")
print ("| |")
print ("| |")
print ("| |")
print ("| PyDOS Version 3.0 Alpha (Alpha 1.2 |")
print ("-------------------------------------------------------------------------------")
selection = input("Select An App: ")
command_actions = {
'ChangeName' : ChangeName,
'SimpleCalc' : simplecalc,
'Shutdown' : shutdown
}
if selection in command_actions:
action = command_actions[selection]
action()
else:
error_message()
Updated - 01/05/15or05/01/15Depending where you are.
Whats New?
- Code updated
- About app now added.
- PyWrite under construction, therefore it has been removed from the home screen.
#PyDOS Version 3.0 - Written by Mrfunny744
import time
import os
import sys
import random
def ChangeName(): #Change your display name
os.system('cls' if os.name == 'nt' else 'clear')
print ("----------------------------------------------")
name = input ("Type in your new username: ")
print()
print ("This can be changed again if you wish.")
print ("----------------------------------------------")
time.sleep(2.5)
def shutdown(): #Shutting down PyDOS
print ("------------------------")
print ("| |")
print ("| Thank you for using |")
print ("| PyDOS |")
print ("| |")
print ("| |")
print ("| |")
print ("| Shutting Down... |")
print ("| |")
print ("------------------------")
sys.exit(0)
def end_simple_calc():
simplecalc()
def end_calc():
print ("Thank you for using SimpleCalc")
time.sleep(2)
def calc(operation, num1, num2): #Operation System for SimpleCalc
if operation == 'a':
return num1 + num2
elif operation == 's': return num1 - num2 elif operation == 'm': return num1 * num2
elif operation == 'd':
if num2 == 0:
raise ValueError('Divide by 0 expection')
return num1 / num2
else:
raise ValueError('Unknown error')
def simplecalc(): #Main screen for SimpleCalc
print ("----------------------------------------------------------")
print ("|Welcome to SimpleCalc! You have the following operators:|")
print ("|A: Add |")
print ("|S: Subtract |")
print ("|M: Multiply |")
print ("|D: Divide |")
print ("|Q: Quit |")
print ("----------------------------------------------------------")
choice = input ("Choice: ").lower()[0]
if choice == 'q':
end_simple_calc()
return
if choice not in "asmd":
print ("Invalid specification.")
end_simple_calc()
return
try:
num1 = int(input("Enter a number: "))
num2 = int(input("Enter a number: "))
print ("Your answer is:", calc(choice, num1, num2))
except ValueError as err:
print(err.args)
end_calc()
def error_message(): #Shown if the app does not exist.
os.system('cls' if os.name == 'nt' else 'clear')
print ("----------------------")
print ("| Whoops! |")
print ("| |")
print ("| |")
print ("| It dosent look |")
print ("| like the app |")
print ("| exists. |")
print ("| |")
print ("|Check and try again.|")
print ("----------------------")
time.sleep(3)
def About(): #About App
print ("-------------------------------------------------------------")
print ("| About PyDOS |")
print ("| |")
print ("| Version: 3.0 (Alpha 1.3) |")
print ("| |")
print ("| Dev Code: 47329257945 |")
print ("| |")
print ("| Serial Key: 357-494-626-181 |")
print ("| |")
print ("| |")
print ("| |")
print ("| |")
print ("| |")
print ("| |")
print ("| |")
print ("| Thanks for using PyDOS! |")
print ("-------------------------------------------------------------")
print ("| |")
print ("| Please press enter to close app |")
print ("| |")
print ("-------------------------------------------------------------")
input()
os.system('cls' if os.name == 'nt' else 'clear') #This is the startup screen. It only appears once beacuse of the While loop below.
print ("---------------------------")
print ("| |")
print ("| |")
print ("| Welcome to PyDOS! |")
print ("| |")
print ("| |")
print ("| |")
print ("| |")
print ("| |")
print ("| Version 3.0 |")
print ("| Alpha Edition |")
print ("| |")
print ("| |")
print ("---------------------------")
time.sleep(3)
print ()
print ("-----------------------------------------------")
name = input ("Enter a name: ")
print ("-----------------------------------------------")
print ("Information has been saved.")
print ()
print ("This data will be used in some applications.")
print ("-----------------------------------------------")
time.sleep(3)
while True: #This is the home screen
os.system('cls' if os.name == 'nt' else 'clear')
print ("-------------------------")
print ("| |")
print ("| |")
print ("| Loading Home |")
print ("| Screen |")
print ("| |")
print ("| |")
print ("| |")
print ("| |")
print ("| |")
print ("-------------------------")
time.sleep(1.5)
os.system('cls' if os.name == 'nt' else 'clear')
print ("-------------------------------------------------------------------------------")
print ("| Username:",name," |")
print ("-------------------------------------------------------------------------------")
print ("| |")
print ("| PyDOS Home Screen - Type in an app below. |")
print ("| |")
print ("| Apps: |")
print ("| |")
print ("| ChangeName |")
print ("| Shutdown |")
print ("| SimpleCalc |")
print ("| About |")
print ("| |")
print ("| |")
print ("| |")
print ("| |")
print ("| PyDOS Version 3.0 Alpha (Alpha 1.2 |")
print ("-------------------------------------------------------------------------------")
selection = input("Select An App: ")
command_actions = {
'ChangeName' : ChangeName,
'SimpleCalc' : simplecalc,
'Shutdown' : shutdown
}
if selection in command_actions:
action = command_actions[selection]
action()
else:
error_message()
#PyDOS Version 3.0 - Written by Mrfunny744
import time
import os
import sys
import random
def ChangeName():
os.system('cls' if os.name == 'nt' else 'clear')
print ("----------------------------------------------")
name = input ("Type in your new username: ")
print()
print ("This can be changed again if you wish.")
print ("----------------------------------------------")
time.sleep(2.5)
def shutdown():
print ("------------------------")
print ("| |")
print ("| Thank you for using |")
print ("| PyDOS |")
print ("| |")
print ("| |")
print ("| |")
print ("| Shutting Down... |")
print ("| |")
print ("------------------------")
sys.exit(0)
def end():
print ("------------------------------------")
print ("| |")
print ("| Thanks for using SimpleCalc! |")
print ("| |")
print ("------------------------------------")
time.sleep(2)
def calc_a():
print ("----------------------------------")
num1 = int(input("Enter a number: "))
num2 = int(input("Enter a number: "))
print ("----------------------------------")
answer = num1+num2
print ("Your answer is:" ,answer)
print ("----------------------------------")
time.sleep(3)
end()
def calc_m():
print ("----------------------------------")
num1 = int(input("Enter a number: "))
num2 = int(input("Enter a number: "))
print ("----------------------------------")
answer = num1*num2
print ("Your answer is:" ,answer)
print ("----------------------------------")
time.sleep(3)
end()
def calc_s():
print ("----------------------------------")
num1 = int(input("Enter a number: "))
num2 = int(input("Enter a number: "))
print ("----------------------------------")
answer = num1-num2
print ("Your answer is:" ,answer)
print ("----------------------------------")
time.sleep(3)
end()
def calc_d():
print ("----------------------------------")
num1 = int(input("Enter a number: "))
num2 = int(input("Enter a number: "))
print ("----------------------------------")
answer = num1/num2
print ("Your answer is:" ,answer)
print ("----------------------------------")
time.sleep(3)
end()
def simplecalc():
print ("--------------------------")
print ("| |")
print ("| Welcome to SimpleCalc |")
print ("| |")
print ("| A = Add |")
print ("| M = Multiply |")
print ("| S = Subtract |")
print ("| D = Divide |")
print ("| Q = Quit |")
print ("| |")
print ("--------------------------")
print ("| |")
choice = input ("| Choice: |")
print ("| |")
print("--------------------------")
if choice == 'a':
calc_a()
elif choice == 'm':
calc_m()
elif choice == 's':
calc_s()
elif choice == 'd':
calc_d()
elif choice == 'q':
end()
else:
print ("Invalid specifacation.")
def error_message():
os.system('cls' if os.name == 'nt' else 'clear')
print ("----------------------")
print ("| Whoops! |")
print ("| |")
print ("| |")
print ("| It dosent look |")
print ("| like the app |")
print ("| exists. |")
print ("| |")
print ("|Check and try again.|")
print ("----------------------")
time.sleep(3)
os.system('cls' if os.name == 'nt' else 'clear')
print ("---------------------------")
print ("| |")
print ("| |")
print ("| Welcome to PyDOS! |")
print ("| |")
print ("| |")
print ("| |")
print ("| |")
print ("| |")
print ("| Version 3.0 |")
print ("| Alpha Edition |")
print ("| |")
print ("| |")
print ("---------------------------")
time.sleep(3)
print ()
print ("-----------------------------------------------")
name = input ("Enter a name: ")
print ("-----------------------------------------------")
print ("Information has been saved.")
print ()
print ("This data will be used in some applications.")
print ("-----------------------------------------------")
time.sleep(3)
while True:
os.system('cls' if os.name == 'nt' else 'clear')
print ("-------------------------")
print ("| |")
print ("| |")
print ("| Loading Home |")
print ("| Screen |")
print ("| |")
print ("| |")
print ("| |")
print ("| |")
print ("| |")
print ("-------------------------")
time.sleep(1.5)
os.system('cls' if os.name == 'nt' else 'clear')
print ("-------------------------------------------------------------------------------")
print ("| Username:",name," |")
print ("-------------------------------------------------------------------------------")
print ("| |")
print ("| PyDOS Home Screen - Type in an app below. |")
print ("| |")
print ("| Apps: |")
print ("| |")
print ("| ChangeName |")
print ("| Shutdown |")
print ("| SimpleCalc |")
print ("| PyWrite |")
print ("| About |")
print ("| |")
print ("| |")
print ("| |")
print ("| PyDOS Version 3.0 Alpha (Alpha 1.2 |")
print ("-------------------------------------------------------------------------------")
selection = input("Select An App: ")
command_actions = {
'ChangeName' : ChangeName,
'SimpleCalc' : simplecalc,
'Shutdown' : shutdown
}
if selection in command_actions:
action = command_actions[selection]
action()
else:
error_message()
Updated - 01/05/15or05/01/15Depending where you are.
Whats New?
- Code updated
- About app now added.
- PyWrite under construction, therefore it has been removed from the home screen.
#PyDOS Version 3.0 - Written by Mrfunny744
import time
import os
import sys
import random
def ChangeName(): #Change your display name
os.system('cls' if os.name == 'nt' else 'clear')
print ("----------------------------------------------")
name = input ("Type in your new username: ")
print()
print ("This can be changed again if you wish.")
print ("----------------------------------------------")
time.sleep(2.5)
def shutdown(): #Shutting down PyDOS
print ("------------------------")
print ("| |")
print ("| Thank you for using |")
print ("| PyDOS |")
print ("| |")
print ("| |")
print ("| |")
print ("| Shutting Down... |")
print ("| |")
print ("------------------------")
sys.exit(0)
def endend_simple_calc():
print simplecalc("------------------------------------")
print
def end_calc("| |"):
print ("| "Thank Thanksyou for using SimpleCalc! |")
print ("| |")
print ("------------------------------------"SimpleCalc")
time.sleep(2)
def calc_acalc(operation, num1, num2): print#Operation ("----------------------------------")
System for SimpleCalc
num1 = int(input("Enterif aoperation number:== "))'a':
return num1 + num2 = int(input("Enter a number:elif "))operation == 's':
print ("--------------------------------- return num1 -") num2
answerelif =operation num1+num2== 'm':
print ("Your answer is:" ,answer)return num1 * num2
printelif ("----------------------------------")operation == 'd':
time.sleep(3) if num2 == 0:
end raise ValueError('Divide by 0 expection')
return num1 / num2
else:
raise ValueError('Unknown error')
def calc_msimplecalc(): #Main screen for SimpleCalc
print ("----------------------------------------------------------")
num1 =print int(input("Enter"|Welcome ato number:SimpleCalc! ")You have the following operators:|")
num2 =print int(input("Enter"|A: aAdd number: ") |")
print ("----------------------------------""|S: Subtract |")
answerprint =("|M: num1*num2Multiply |")
print ("Your"|D: answerDivide is |")
print ("|Q:" ,answerQuit |")
print ("----------------------------------------------------------")
time.sleep(3)
end()
def calc_s():
print ("----------------------------------")
num1 = int(input("Enter a number: "))
num2choice = int(input("Enter a number: "))
print ("----------------------------------")
answer = num1-num2
print ("Your answer is"Choice:" ,answer)
print ("----------------------------------")
time.sleep(3)
endlower()[0]
def calc_d():
print ("----------------------------------")
num1 = int(input("Enter a number: "))
num2 = int(input("Enter a number: "))
print ("----------------------------------")
answer = num1/num2
printif ("Yourchoice answer== is'q':" ,answer)
print ("----------------------------------")
time.sleepend_simple_calc(3)
end()
return
if choice not in "asmd":
print ("Invalid specification.")
end_simple_calc()
return
def simplecalc():
print ("--------------------------")
print ("| |")try:
print ("| Welcome to SimpleCalc |")
num1 print= int("| |")
print input("| A = Add "Enter a number: |"")
print ("| M = Multiply |")
print ("| S = Subtract |")
print ("| Dnum2 = Divide |")
print int("| Q = Quit |")
print input("| |")
"Enter a printnumber: ("--------------------------")
print ("| |")
choice = input ("| Choice: |")
print ("| |")
print ("--------------------------")
if choice == 'a':
calc_a()
elif choice"Your ==answer 'm'is:", calc_mcalc()
elif choice == 's':
, num1, calc_s(num2)
elif choice == 'd':
calc_d()
elif choice == 'q':
end()
except ValueError as elseerr:
print("Invalid specifacationerr."args)
end_calc()
def error_message(): #Shown if the app does not exist.
os.system('cls' if os.name == 'nt' else 'clear')
print ("----------------------")
print ("| Whoops! |")
print ("| |")
print ("| |")
print ("| It dosent look |")
print ("| like the app |")
print ("| exists. |")
print ("| |")
print ("|Check and try again.|")
print ("----------------------")
time.sleep(3)
def About(): #About App
print ("-------------------------------------------------------------")
print ("| About PyDOS |")
print ("| |")
print ("| Version: 3.0 (Alpha 1.3) |")
print ("| |")
print ("| Dev Code: 47329257945 |")
print ("| |")
print ("| Serial Key: 357-494-626-181 |")
print ("| |")
print ("| |")
print ("| |")
print ("| |")
print ("| |")
print ("| |")
print ("| |")
print ("| Thanks for using PyDOS! |")
print ("-------------------------------------------------------------")
print ("| |")
print ("| Please press enter to close app |")
print ("| |")
print ("-------------------------------------------------------------")
input()
os.system('cls' if os.name == 'nt' else 'clear') #This is the startup screen. It only appears once beacuse of the While loop below.
print ("---------------------------")
print ("| |")
print ("| |")
print ("| Welcome to PyDOS! |")
print ("| |")
print ("| |")
print ("| |")
print ("| |")
print ("| |")
print ("| Version 3.0 |")
print ("| Alpha Edition |")
print ("| |")
print ("| |")
print ("---------------------------")
time.sleep(3)
print ()
print ("-----------------------------------------------")
name = input ("Enter a name: ")
print ("-----------------------------------------------")
print ("Information has been saved.")
print ()
print ("This data will be used in some applications.")
print ("-----------------------------------------------")
time.sleep(3)
while True: #This is the home screen
os.system('cls' if os.name == 'nt' else 'clear')
print ("-------------------------")
print ("| |")
print ("| |")
print ("| Loading Home |")
print ("| Screen |")
print ("| |")
print ("| |")
print ("| |")
print ("| |")
print ("| |")
print ("-------------------------")
time.sleep(1.5)
os.system('cls' if os.name == 'nt' else 'clear')
print ("-------------------------------------------------------------------------------")
print ("| Username:",name," |")
print ("-------------------------------------------------------------------------------")
print ("| |")
print ("| PyDOS Home Screen - Type in an app below. |")
print ("| |")
print ("| Apps: |")
print ("| |")
print ("| ChangeName |")
print ("| Shutdown |")
print ("| SimpleCalc |")
print ("| PyWrite |")
print ("| About |")
print ("| |")
print ("| |")
print ("| |")
print ("| |")
print ("| PyDOS Version 3.0 Alpha (Alpha 1.2 |")
print ("-------------------------------------------------------------------------------")
selection = input("Select An App: ")
command_actions = {
'ChangeName' : ChangeName,
'SimpleCalc' : simplecalc,
'Shutdown' : shutdown
}
if selection in command_actions:
action = command_actions[selection]
action()
else:
error_message()
#PyDOS Version 3.0 - Written by Mrfunny744
import time
import os
import sys
import random
def ChangeName():
os.system('cls' if os.name == 'nt' else 'clear')
print ("----------------------------------------------")
name = input ("Type in your new username: ")
print()
print ("This can be changed again if you wish.")
print ("----------------------------------------------")
time.sleep(2.5)
def shutdown():
print ("------------------------")
print ("| |")
print ("| Thank you for using |")
print ("| PyDOS |")
print ("| |")
print ("| |")
print ("| |")
print ("| Shutting Down... |")
print ("| |")
print ("------------------------")
sys.exit(0)
def end():
print ("------------------------------------")
print ("| |")
print ("| Thanks for using SimpleCalc! |")
print ("| |")
print ("------------------------------------")
time.sleep(2)
def calc_a(): print ("----------------------------------")
num1 = int(input("Enter a number: "))
num2 = int(input("Enter a number: "))
print ("----------------------------------")
answer = num1+num2
print ("Your answer is:" ,answer)
print ("----------------------------------")
time.sleep(3)
end()
def calc_m():
print ("----------------------------------")
num1 = int(input("Enter a number: "))
num2 = int(input("Enter a number: "))
print ("----------------------------------")
answer = num1*num2
print ("Your answer is:" ,answer)
print ("----------------------------------")
time.sleep(3)
end()
def calc_s():
print ("----------------------------------")
num1 = int(input("Enter a number: "))
num2 = int(input("Enter a number: "))
print ("----------------------------------")
answer = num1-num2
print ("Your answer is:" ,answer)
print ("----------------------------------")
time.sleep(3)
end()
def calc_d():
print ("----------------------------------")
num1 = int(input("Enter a number: "))
num2 = int(input("Enter a number: "))
print ("----------------------------------")
answer = num1/num2
print ("Your answer is:" ,answer)
print ("----------------------------------")
time.sleep(3)
end()
def simplecalc():
print ("--------------------------")
print ("| |")
print ("| Welcome to SimpleCalc |")
print ("| |")
print ("| A = Add |")
print ("| M = Multiply |")
print ("| S = Subtract |")
print ("| D = Divide |")
print ("| Q = Quit |")
print ("| |")
print ("--------------------------")
print ("| |")
choice = input ("| Choice: |")
print ("| |")
print ("--------------------------")
if choice == 'a':
calc_a()
elif choice == 'm': calc_m()
elif choice == 's':
calc_s()
elif choice == 'd':
calc_d()
elif choice == 'q':
end()
else:
print("Invalid specifacation.")
def error_message():
os.system('cls' if os.name == 'nt' else 'clear')
print ("----------------------")
print ("| Whoops! |")
print ("| |")
print ("| |")
print ("| It dosent look |")
print ("| like the app |")
print ("| exists. |")
print ("| |")
print ("|Check and try again.|")
print ("----------------------")
time.sleep(3)
os.system('cls' if os.name == 'nt' else 'clear')
print ("---------------------------")
print ("| |")
print ("| |")
print ("| Welcome to PyDOS! |")
print ("| |")
print ("| |")
print ("| |")
print ("| |")
print ("| |")
print ("| Version 3.0 |")
print ("| Alpha Edition |")
print ("| |")
print ("| |")
print ("---------------------------")
time.sleep(3)
print ()
print ("-----------------------------------------------")
name = input ("Enter a name: ")
print ("-----------------------------------------------")
print ("Information has been saved.")
print ()
print ("This data will be used in some applications.")
print ("-----------------------------------------------")
time.sleep(3)
while True:
os.system('cls' if os.name == 'nt' else 'clear')
print ("-------------------------")
print ("| |")
print ("| |")
print ("| Loading Home |")
print ("| Screen |")
print ("| |")
print ("| |")
print ("| |")
print ("| |")
print ("| |")
print ("-------------------------")
time.sleep(1.5)
os.system('cls' if os.name == 'nt' else 'clear')
print ("-------------------------------------------------------------------------------")
print ("| Username:",name," |")
print ("-------------------------------------------------------------------------------")
print ("| |")
print ("| PyDOS Home Screen - Type in an app below. |")
print ("| |")
print ("| Apps: |")
print ("| |")
print ("| ChangeName |")
print ("| Shutdown |")
print ("| SimpleCalc |")
print ("| PyWrite |")
print ("| About |")
print ("| |")
print ("| |")
print ("| |")
print ("| PyDOS Version 3.0 Alpha (Alpha 1.2 |")
print ("-------------------------------------------------------------------------------")
selection = input("Select An App: ")
command_actions = {
'ChangeName' : ChangeName,
'SimpleCalc' : simplecalc,
'Shutdown' : shutdown
}
if selection in command_actions:
action = command_actions[selection]
action()
else:
error_message()
Updated - 01/05/15or05/01/15Depending where you are.
Whats New?
- Code updated
- About app now added.
- PyWrite under construction, therefore it has been removed from the home screen.
#PyDOS Version 3.0 - Written by Mrfunny744
import time
import os
import sys
import random
def ChangeName(): #Change your display name
os.system('cls' if os.name == 'nt' else 'clear')
print ("----------------------------------------------")
name = input ("Type in your new username: ")
print()
print ("This can be changed again if you wish.")
print ("----------------------------------------------")
time.sleep(2.5)
def shutdown(): #Shutting down PyDOS
print ("------------------------")
print ("| |")
print ("| Thank you for using |")
print ("| PyDOS |")
print ("| |")
print ("| |")
print ("| |")
print ("| Shutting Down... |")
print ("| |")
print ("------------------------")
sys.exit(0)
def end_simple_calc():
simplecalc()
def end_calc():
print ("Thank you for using SimpleCalc")
time.sleep(2)
def calc(operation, num1, num2): #Operation System for SimpleCalc
if operation == 'a':
return num1 + num2 elif operation == 's':
return num1 - num2
elif operation == 'm':
return num1 * num2
elif operation == 'd':
if num2 == 0:
raise ValueError('Divide by 0 expection')
return num1 / num2
else:
raise ValueError('Unknown error')
def simplecalc(): #Main screen for SimpleCalc
print ("----------------------------------------------------------")
print ("|Welcome to SimpleCalc! You have the following operators:|")
print ("|A: Add |")
print ("|S: Subtract |")
print ("|M: Multiply |")
print ("|D: Divide |")
print ("|Q: Quit |")
print ("----------------------------------------------------------")
choice = input ("Choice: ").lower()[0]
if choice == 'q':
end_simple_calc()
return
if choice not in "asmd":
print ("Invalid specification.")
end_simple_calc()
return
try:
num1 = int(input("Enter a number: "))
num2 = int(input("Enter a number: "))
print ("Your answer is:", calc(choice, num1, num2))
except ValueError as err:
print(err.args)
end_calc()
def error_message(): #Shown if the app does not exist.
os.system('cls' if os.name == 'nt' else 'clear')
print ("----------------------")
print ("| Whoops! |")
print ("| |")
print ("| |")
print ("| It dosent look |")
print ("| like the app |")
print ("| exists. |")
print ("| |")
print ("|Check and try again.|")
print ("----------------------")
time.sleep(3)
def About(): #About App
print ("-------------------------------------------------------------")
print ("| About PyDOS |")
print ("| |")
print ("| Version: 3.0 (Alpha 1.3) |")
print ("| |")
print ("| Dev Code: 47329257945 |")
print ("| |")
print ("| Serial Key: 357-494-626-181 |")
print ("| |")
print ("| |")
print ("| |")
print ("| |")
print ("| |")
print ("| |")
print ("| |")
print ("| Thanks for using PyDOS! |")
print ("-------------------------------------------------------------")
print ("| |")
print ("| Please press enter to close app |")
print ("| |")
print ("-------------------------------------------------------------")
input()
os.system('cls' if os.name == 'nt' else 'clear') #This is the startup screen. It only appears once beacuse of the While loop below.
print ("---------------------------")
print ("| |")
print ("| |")
print ("| Welcome to PyDOS! |")
print ("| |")
print ("| |")
print ("| |")
print ("| |")
print ("| |")
print ("| Version 3.0 |")
print ("| Alpha Edition |")
print ("| |")
print ("| |")
print ("---------------------------")
time.sleep(3)
print ()
print ("-----------------------------------------------")
name = input ("Enter a name: ")
print ("-----------------------------------------------")
print ("Information has been saved.")
print ()
print ("This data will be used in some applications.")
print ("-----------------------------------------------")
time.sleep(3)
while True: #This is the home screen
os.system('cls' if os.name == 'nt' else 'clear')
print ("-------------------------")
print ("| |")
print ("| |")
print ("| Loading Home |")
print ("| Screen |")
print ("| |")
print ("| |")
print ("| |")
print ("| |")
print ("| |")
print ("-------------------------")
time.sleep(1.5)
os.system('cls' if os.name == 'nt' else 'clear')
print ("-------------------------------------------------------------------------------")
print ("| Username:",name," |")
print ("-------------------------------------------------------------------------------")
print ("| |")
print ("| PyDOS Home Screen - Type in an app below. |")
print ("| |")
print ("| Apps: |")
print ("| |")
print ("| ChangeName |")
print ("| Shutdown |")
print ("| SimpleCalc |")
print ("| About |")
print ("| |")
print ("| |")
print ("| |")
print ("| |")
print ("| PyDOS Version 3.0 Alpha (Alpha 1.2 |")
print ("-------------------------------------------------------------------------------")
selection = input("Select An App: ")
command_actions = {
'ChangeName' : ChangeName,
'SimpleCalc' : simplecalc,
'Shutdown' : shutdown
}
if selection in command_actions:
action = command_actions[selection]
action()
else:
error_message()