This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#26 2011-04-18 20:44:44

ThePCKid
Scratcher
Registered: 2009-09-16
Posts: 1000+

Re: PY-DOS, my fake DOS OS written in Python

ssss wrote:

does this work better?

Code:

note = ""
def app_note():
    global note
    print("Welcome to the note app! Here you can write a note and leave it for later.")
    print('\n')
    if note == "":
        areusure = str(input("You don't seem to have a note. Write one now? [Y/N] "))
        if areusure == "Y":
            note = str(input("Write your note here: "))
            print("Note saved")
            load_the_os(0)
        else:
            load_the_os(0)
    else:
        print("Current note:", note)
        areusure = str(input("Make new note? [Y/N] "))
        if areusure == "Y":
            note = str(input("Write your note here: "))
            print("Note saved")
            load_the_os(0)
        else:
            load_the_os(0)
        
def show_the_ver():
    print("PY-DOS v0.3 by ThePCKid on Scratch")
    load_the_os(0)

def get_some_help():
    print("help     Display this help screen")
    print("ver      Display the version of this fake OS")
    print("stop     Shutdown PY-DOS")
    print("logout   Logout of PY-DOS")
    print("note     Launch the note app")
    load_the_os(0)

def load_the_os(i):
    if i == 1:
        print("Type 'help' for help")
        print("Please note that because PY-DOS is written in Python, command names, usernames, and passwords are case-sensitive.")
    inpt = str(input(">"))

    if inpt == "help":
        get_some_help()
    elif inpt == "ver":
        show_the_ver()
    elif inpt == "stop":
        areusure = str(input("Are you sure? [Y/N] "))
        if areusure == "Y":
            pass
        else:
            load_the_os(0)
    elif inpt == "logout":
        for i in range(0, 15):
            print('\n')
        try_to_login()
    elif inpt == "note":
        app_note()
    else:
        print("Unknown command. Try 'help' to get a list of known commands.")
        load_the_os(0)

def try_to_login():
    tempuser = temppass = ""
    tempuser = str(input("Username: "))
    temppass = str(input("Password: "))
    if tempuser == username:
        if temppass == password:
            print("Logged in!")

            for i in range(0, 25):
                print('\n')

            load_the_os(1);
        else:
            print("Incorrect password")
            try_to_login()
    else:
        print("Incorrect username")
        try_to_login()

username = password = ""

username = str(input("Enter your desired username: "))
password = str(input("Enter your desired password: "))
for i in range(0, 25):
    print('\n')

try_to_login()

There is no change...

Offline

 

Board footer