Ich habe einen einfachen DOS-Klon Ich rufe JDOS oder Jacobs DOS, und ich frage mich, was es fehlt?Was muss hinzugefügt werden
Wenn Sie es versuchen, gibt es einen Befehl, der nicht (absichtlich) admin
genannt wird. Das Passwort ist leer, drücken Sie einfach die Eingabetaste.
Ich bin ein Anfänger Programmierer in Python, also machen Sie es eine Herausforderung, aber nicht zu schwer, bitte.
Hier ist das Skript:
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 [email protected]"
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 [email protected]"
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()
Diese Frage zu implementieren äußerst vage ist und Sie hat uns eine Menge Code zum Lesen gegeben. Warum glaubst du, dass etwas fehlt? Welches Verhalten erwarten Sie und was sehen Sie stattdessen? – jcolemang
Ich stimme zu, diese Frage als Off-Topic zu schließen, da es sich nicht um eine Frage der Programmierung handelt. – smarx