mercredi 27 juillet 2016

Python Ignore if/else Command? [duplicate]

This question already has an answer here:

The python if/else command is completely not working.

import time
import os
import sys

def zelphaMain():
    def zelphaMain_Credits():
        print("Coding:")
        print("John Antonio Anselmo")
        print("")
        print("")
        print(">>Back")
        def zelphaMain_CreditsInput_Options():
            zelphaMain_CreditsInput = input(">> ")
            if zelphaMain_CreditsInput == ("back") or ("Back"):
                os.system('cls')
                zelphaMain()
            else:
                print("What you have entered is not a valid command")
                zelphaMain_CreditsInput_Options()
        zelphaMain_CreditsInput_Options()

    def zelphaMain_Game():
        print("*")
        time.sleep(1)
        print("*")
        time.sleep(1)
        print("*")
        time.sleep(1)
        os.system('cls')
        time.sleep(1)
        print("Zelpha808")
        time.sleep(1)
        print("")
        print("Booting...")
        time.sleep(8)
        os.system('cls')
    def zelphaMain_Menu():
        print("Main Menu")
        print("")
        print("")
        print("Welcome to Zelpha808")
        print("")
        print("")
        print(">>Start")
        print(">>Credits")
        print("")
        zelphaMain_MenuInput = input(">> ")
        if zelphaMain_MenuInput == ("Credits") or ("credits"):
            zelphaMain_Credits()
        else:
            exit()

    zelphaMain_Menu()

zelphaMain()

Down to if zelphaMain_MenuInput == ("Credits") or ("credits"): when I run the program, and get to the main menu of the game, no matter what I input, the program goes on to zelphaMain_Credits(). And in the credits, no matter what I input, it acts as if I inputted "back". I have no idea what is happening, if any of you are confused or need clarification, I'd be happy to add more details.

Aucun commentaire:

Enregistrer un commentaire