示例#1
0
try:

    import myPythonFunctions as m

    userName = input(
        'Please enter your user name or create a new one if this is your first time playing: '
    )

    userScore = int(m.getUserPoint(userName))

    if userScore == -1:
        newUser = True
        userScore = 0
    else:
        newUser = False

    userChoice = 0

    while userChoice != 'e':
        userScore += m.generateQuestion()
        print("Current Score:  ", userScore)
        userChoice = input('Press Enter to Continue or type e to Exit: ')

    m.updateUserPoints(newUser, userName, str(userScore))

except Exception as e:
    print(
        "An unexpected error occurred.  Program will exit.  Please try again later."
    )
示例#2
0
# mathGame.py
from myPythonFunctions import getUserPoint

userScore = getUserPoint(input("Who's score do you want to see? :"))
print('\n----------------------\n--> ', userScore)
示例#3
0
try:

	import myPythonFunctions as m

	userName = input("Your name: \n")
	userScore = int(m.getUserPoint(userName))

	if userScore == -1:
		newUser = True
		userScore = 0
	else:
		newUser = False
	userChoice = 0
	while userChoice!='-1':
		userScore += m.generateQuestions()
		print("score", userScore)
		userChoice = input("Enter to Continue or -1 to Exit")
		print userChoice
	m.updateUserPoints(newUser, userName, str(userScore))

except Exception as e:
		print ("An unexpected error occurred. Program will be exited")

示例#4
0
try:
    import os
    import sys
    sys.path.append("modules")
    from myPythonFunctions import getUserPoint, updateUserPoints, generateQuestion

    userName = input("Enter your user name: ")

    if getUserPoint(userName) == "-1":
        newUser = True
    else:
        newUser = False

    userChoice = ''
    userScore = 0
    while userChoice != "-1":
        userScore = userScore + generateQuestion()
        userChoice = input(
            "Enter -1 to exit the game or press any key to continue: ")

    updateUserPoints(newUser, userName, str(userScore))

except Exception as err:
    print("Unknown Error: " + str(err))