samedi 19 septembre 2015

Nestled if else and loop help python 3

two questions, how can i nestle if + else statements between other if + else statements? How can i loop back to the top of my code when the else statement is activated?

print("Welcome To Your Workstation.")
usrname = input("Username: ")
pssword = input("Password: ")
if usrname=="Harry" and pssword=="password123":
    print("-=-=-=Welcome=-=-=-")
    print("Enter A Program Name")
    print("You can use:add_up")
    program = input(":")
    if program=="add_up":
            print("Ok, Lets Get Adding!")
            num1 = input(int(float("Enter Your First Number: ")
            num2 = input(int(float("Enter Your Second Number: ")
            num3 = input(int(float("Enter Your Third Number: ")
            answer = num1 + num2 + num3
            print(num1"+"num2"+"num3"="answer)
    else:
        print("Unknown Command, Reboot And Try Again.")

else:
    print("Incorrect Password, Reboot And Try Again"

I am a python noob in need of help :)

Aucun commentaire:

Enregistrer un commentaire