Exemple #1
0
#########################################
### Define your functions here 
#########################################
# def showInvalidOrSuccess(message):
#     print(message)
#     input("Press any key to continue: ")



#########################################


### main logic
while(True):
    tableDisplay.display(data)
    navDisplay.printMainMenu()

    userAction = input("What would you like to do? : ")
    userAction = int(userAction)

    if(userAction == 1):
        # insert new data logic
        ...

    elif(userAction == 2):
        # search by name
        ...

    elif(userAction == 3):
        # edit logic here
# load data
csvRW = CsvReadWriter(DATA_PATH_CSV)
data = csvRW.loadAsDictionary()

# create display instance
tableDisplay = TableDisplay(data[0].keys())
navDisplay = NavigationDisplay()
# do not delete the code in here ##############################

def showInvalidOrSuccess(message):
    print(message)
    input("Press any key to continue: ")

while(True):
    tableDisplay.display(data)
    navDisplay.printMainMenu()

    userAction = input("What would you like to do? : ")
    userAction = int(userAction)

    if(userAction == 1):
        tableDisplay.display(data)

        # get info
        name = input("What is the name of the new contact?: ")
        relation = input("What is the relationship of the new contact?: ")
        home = input("What is the home contact number? Leave blank if there is none: ")
        mobile = input("What is the mobile contact number? Leave blank if there is none: ")

        newContact = {
            showMessage("CONGRATULATIONS WE HAVE A NEW HIGH SCORE!")

        print()
        ans = input("Retry? (Y/N): ")
        repeat = False if ans == "n" or ans == "N" else True

    playerObj = {"name": playerName, "score": playerScore}
    addScoreToData(playerObj)


while (True):
    clearScreen()
    print("\tWelcome to the Quiz Game!")
    print()
    navDisplay.printMainMenu()

    userAction = input("What would you like to do? ")
    userAction = int(userAction)

    if (userAction == 1):
        name = input("Insert your name: ")
        playGame(name)
    elif (userAction == 2):
        tableDisplay.display(scoreBoardData)
        showMessage("")
    elif (userAction == 3):
        break
    else:
        showMessage("Invalid input!")

navDisplay.printExit()