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." )
''' Created on Oct 21, 2015 @author: scott.kilker ''' from myPythonFunctions import getUserPoint, generateQuestion from myPythonFunctions import updateUserPoint try: userName = input("Enter User Name: ") userScore = int(getUserPoint(userName)) print(userScore) newUser = False if userScore == -1: newUser = True userScore = 0 userChoice = 0 while userChoice != "Quit": userScore += generateQuestion() print(userScore) userChoice = input("Enter 'Quit' to quit") updateUserPoint(newUser,userName,userScore) except: print("An Exception occurred and program will now terminate")
try: import myPythonFunctions as mpf print('What is your name: ') userName = input() userScore = int(mpf.getUserScore(userName)) newUser = userScore == -1 if newUser: userScore = 0 userChoice = 0 while userChoice != '-1': userScore += mpf.generateQuestion() print('Continue? (type -1 to exit)') userChoice = input() mpf.updateUserPoints(newUser, userName, str(userScore)) except Exception as e: print(e)
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))