我有一个简单的DOS
克隆,我称之为JDOS
,或者雅各布的DOS
,我想知道它缺少了什么或者我应该补充什么?你知道吗
如果您正在尝试,有一个命令没有列出(故意的),名为admin
。密码是空的,所以只要按回车键。你知道吗
我是Python的初学者,所以让它成为一个挑战。任何事对我来说都不难学。你知道吗
剧本如下:
def jdos1():
print " Boot JDOS.exe?"
answer = raw_input(" [y] or [n]").lower()
if answer == "y" or answer == "[y]":
import time
time.sleep(1)
print " Welcome to JDOS"
time.sleep(1)
print " Type cmds for a list of all avalible commands"
def jdos2():
cmd = raw_input().lower()
if cmd == "exit":
print " Exiting JDOS"
time.sleep(1)
elif cmd == "info":
print "JDOS Script 1.4.0. Created by Jacob Snyder jacobsnyderatoneal@gmail.com"
jdos2()
elif cmd == "ver":
print "JDOS 1.4.0"
jdos2()
elif cmd == "upd":
print ""
jdos2()
elif cmd =="admin":
password = raw_input(" Please enter your admin password.")
def admin():
if password == "".lower():
print " rebooting in admin mode"
time.sleep(1)
print " Welcome to JDOS-Admin"
def admin2():
cmd = raw_input().lower()
if cmd == "exit":
print " Exiting JDOS-Admin"
time.sleep(3)
elif cmd == "password":
print " Your password is, %s" % (password)
admin2()
elif cmd == "admin":
print " Already booted in admin mode"
admin2()
elif cmd == "format":
print " Formatting D:"
time.sleep(3)
elif cmd == "ver":
print " JDOS 1.4.0"
admin2()
elif cmd == "info":
print " JDOS-Admin Script 1.4.0. Created by Jacob Snyder jacobsnyderatoneal@gmail.com"
admin2()
elif cmd == "upd":
print ""
admin2()
elif cmd == "date":
from datetime import datetime
now = datetime.now()
print ' %s/%s/%s' % (now.month, now.day, now.year)
admin2()
elif cmd == "add":
inp1 = float(raw_input(" Enter 1st integer:"))
inp2 = float(raw_input(" Enter 2nd integer:"))
oup1 = inp1 + inp2
print " %s+%s=%s" % (inp1, inp2, oup1)
admin2()
elif cmd == "subtract":
inp1 = float(raw_input(" Enter 1st integer:"))
inp2 = float(raw_input(" Enter 2nd integer:"))
oup1 = inp1 - inp2
print " %s-%s=%s" % (inp1, inp2, oup1)
admin2()
elif cmd == "multiply":
inp1 = float(raw_input(" Enter 1st integer:"))
inp2 = float(raw_input(" Enter 2nd integer:"))
oup1 = inp1 * inp2
print " %sx%s=%s" % (inp1, inp2, oup1)
admin2()
elif cmd == "divide":
inp1 = float(raw_input(" Enter 1st integer:"))
inp2 = float(raw_input(" Enter 2nd integer:"))
oup1 = inp1 / inp2
print " %s/%s=%s" % (inp1, inp2, oup1)
admin2()
elif cmd == "cmds" or cmd == "cmd":
print " cmds, date, add, subtract, multiply, divide, password, admin, format, ver, info, upd, exit"
admin2()
else:
print " Invalid command"
admin2()
admin2()
elif password == "cancel":
print " Canceling"
else:
print " Incorrect password"
admin()
elif cmd == "secret":
print " Congrats on finding the secret, Heres a cookie! . ____ ./- . \ |, - * | .\____/"
jdos2()
elif cmd == "date":
from datetime import datetime
now = datetime.now()
print ' %s/%s/%s' % (now.month, now.day, now.year)
jdos2()
elif cmd == "add":
inp1 = float(raw_input(" Enter 1st integer:"))
inp2 = float(raw_input(" Enter 2nd integer:"))
oup1 = inp1 + inp2
print "%s+%s=%s" % (inp1, inp2, oup1)
jdos2()
elif cmd == "subtract":
inp1 = float(raw_input(" Enter 1st integer:"))
inp2 = float(raw_input(" Enter 2nd integer:"))
oup1 = inp1 - inp2
print "%s-%s=%s" % (inp1, inp2, oup1)
jdos2()
elif cmd == "multiply":
inp1 = float(raw_input(" Enter 1st integer:"))
inp2 = float(raw_input(" Enter 2nd integer:"))
oup1 = inp1 * inp2
jdos2()
elif cmd == "divide":
inp1 = float(raw_input(" Enter 1st integer:"))
inp2 = float(raw_input(" Enter 2nd integer:"))
oup1 = inp1 / inp2
print "%s/%s=%s" % (inp1, inp2, oup1)
jdos2()
elif cmd == "cmds" or cmd == "cmd":
print " cmds, date, add, subtract, multiply, divide, info, upd, ver, exit"
jdos2()
else:
print " Invalid command"
jdos2()
jdos2()
elif answer == "n":
print ""
else:
print " Invalid command"
jdos1()
jdos1()
Jacob,在cmd提示符下运行
help
,您将得到一个供您实现的大量可用命令列表相关问题 更多 >
编程相关推荐