Created
November 9, 2017 16:08
-
-
Save Leowbattle/1c85a013c622aa4d11ed6bb5240eb45d to your computer and use it in GitHub Desktop.
Some Homework
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Set of default scores used to quickly debug without typing in scores every time. | |
# Scores taken from the booklet PDF. | |
defaultScores = {"A": [6, 9, 9, 10, 5], | |
"B": [7, 6, 8, 5, 4], | |
"C": [9, 5, 4, 7, 8], | |
"D": [5, 6, 9, 7, 6], | |
"E": [5, 6, 9, 7, 6], | |
"F": [6, 4, 7, 8, 7] | |
} | |
# The actual scores that will be used in the real version of the program | |
scoresRoundOne = { | |
"A": [0] * 5, | |
"B": [0] * 5, | |
"C": [0] * 5, | |
"D": [0] * 5, | |
"E": [0] * 5, | |
"F": [0] * 5 | |
} | |
scoresRoundTwo = { | |
"A": [0] * 5, | |
"B": [0] * 5, | |
"C": [0] * 5, | |
"D": [0] * 5, | |
"E": [0] * 5, | |
"F": [0] * 5 | |
} | |
scoresRoundThree = { | |
"A": [0] * 5, | |
"B": [0] * 5, | |
"C": [0] * 5, | |
"D": [0] * 5, | |
"E": [0] * 5, | |
"F": [0] * 5 | |
} | |
lastInput = None | |
# Calculates the total score for a couple for a round. | |
# If couple is None it will do it for all couples. | |
# If roundNumber is None it will do it for all rounds. | |
# couple: int array | |
# roundNumber: int | |
def calculateScoreTotalForRound(couple, roundNumber): | |
pass | |
# Calculates the average score for a couple in a round. | |
# If couple is None it will do it for all couples. | |
# If roundNumber is None it will do it for all rounds. | |
# couple: int array | |
# roundNumber: int | |
def calculateAverageScoreForRound(couple, roundNumber): | |
pass | |
# Edit scores for a round for a couple | |
# If couple is None it will do it for all couples. | |
# If roundNumber is None it will do it for all rounds. | |
# couple: int array | |
# roundNumber: int | |
def editScores(couple, roundNumber): | |
scores = None | |
if roundNumber == 1: | |
scores = scoresRoundOne[couple.upper()] | |
elif roundNumber == 2: | |
scores = scoresRoundTwo[couple.upper()] | |
elif roundNumber == 3: | |
scores = scoresRoundThree[couple.upper()] | |
else: | |
raise ValueError("{0} is not a valid round number".format(roundNumber)) | |
for score in scores: | |
try: | |
scores[score] = int(input()) | |
except: | |
print("That was not an integer") | |
editScores(couple, roundNumber) | |
continue | |
print(scores) | |
# View a table of scores for a couple for a round | |
# If couple is None it will do it for all couples. | |
# If roundNumber is None it will do it for all rounds. | |
# couple: int array | |
# roundNumber: int | |
def viewScores(couple, roundNumber): | |
pass | |
# Processes user input to decide if the user wants to: | |
# Edit the scores of a round | |
# Edit the scores of a couple | |
# View the scores of a round | |
# View the scores of a couple | |
def menuInput(): | |
global lastInput | |
lastInput = input("Please type in the number of the process you would like to perform.\n1 for edit the scores.\n2 for view the scores.\nType \"exit\" or 3 to terminate the program\n>>> ") | |
if lastInput.lower() == "help": | |
menuInput() | |
return | |
elif lastInput.lower() == "exit" or lastInput.lower() == "3": | |
exit(1) | |
elif lastInput == "1": | |
lastInput = input("Which couple? Type a letter from a to f.\n>>> ") | |
couple = None | |
if lastInput.lower() in ["a", "b", "c", "d", "e", "f"]: | |
couple = lastInput.upper() | |
else: | |
print("That was not the reuqired input") | |
lastInput = input("Which round? Type a number from 1 to 3.\n>>> ") | |
try: | |
if int(lastInput) < 1 or int(lastInput) > 3: | |
print("That was not an integer within the required range") | |
except: | |
print("That was not an integer") | |
lastInput = int(lastInput) | |
scores = None | |
if lastInput == 1: | |
scores = scoresRoundOne[couple] | |
elif lastInput == 2: | |
scores = scoresRoundTwo[couple] | |
elif lastInput == 3: | |
scores = scoresRoundThree[couple] | |
else: | |
pass | |
# We have the required input and it is in the valid data types | |
for score in scores: | |
try: | |
scores[score] = int(input()) | |
except: | |
print("That was not an integer or it was too big or small") | |
print("The scores are now:\n{0}".format(scores)) | |
pass | |
elif lastInput == "2": | |
print("Round one: ", scoresRoundOne) | |
print("Round two: ", scoresRoundTwo) | |
print("Round three: ", scoresRoundThree) | |
def main(): | |
print("Welcome to the Dancers UK Competetive Score Keeping Program v0.1 (C) 2017 All Rights Reserved") | |
while True: | |
menuInput() | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment