Skip to content
Permalink
Browse files
attempt at making things easier to work with e.g. less copy pasting o…
…f code
  • Loading branch information
masudm6 committed Oct 1, 2020
1 parent 1032950 commit 4e18083d851c9f079d54a2133f2c4ee820632816
Showing 1 changed file with 152 additions and 0 deletions.
@@ -0,0 +1,152 @@
'''
sphinx story
is good
https://github.coventry.ac.uk/lycette2/CuriosityKilledTheSphinx
choice = input("Enter choice:\nA = []\nB = []\nC = []\n->")
'''

history = [] # empty storage area for choices

def start():
loop = True
difficulty = ""

while loop == True:

difficulty = input("Enter Difficulty:\nA = EASY\nB = MEDIUM\nC = HARD\n->")
if difficulty == "a" or difficulty == "A":
print("You have selected EASY")
loop = False
elif difficulty == "b" or difficulty == "B":
print("You have selected MEDIUM")
loop = False
elif difficulty == "c" or difficulty == "C":
print("You have selected HARD")
loop = False
else:
print("Please enter a valid option.")

history.append(difficulty.upper())


def getAnswer1(question, text):
loop = True
choice = ""

while loop == True:
print(question)
choice = input("Enter choice:"
"\nA = " + text["A"] +
"\n->")

if choice == "a" or choice == "A":
print("You have selected A: " + text[choice.upper()])
loop = False
else:
print("Please enter a valid option.") # runs if the answer is not valid

history.append(choice.upper()) # adds the choice the user picked


def getAnswer2(question, text):
loop = True
choice = ""

while loop == True:
print(question)
choice = input("Enter choice:"
"\nA = " + text["A"] +
"\nB = " + text["B"] +
"\n->")

if choice == "a" or choice == "A":
print("You have selected A: " + text[choice.upper()])
loop = False
elif choice == "b" or choice == "B":
print("You have selected B: " + text[choice.upper()])
loop = False
else:
print("Please enter a valid option.") # runs if the answer is not valid

history.append(choice.upper()) # adds the choice the user picked

def getAnswer3(question, text):
loop = True
choice = ""

while loop == True:
print(question)
choice = input("Enter choice:"
"\nA = " + text["A"] +
"\nB = " + text["B"] +
"\nC = " + text["C"] +
"\n->")

if choice == "a" or choice == "A":
print("You have selected A: " + text[choice.upper()])
loop = False
elif choice == "b" or choice == "B":
print("You have selected B: " + text[choice.upper()])
loop = False
elif choice == "c" or choice == "C":
print("You have selected C: " + text[choice.upper()])
loop = False
else:
print("Please enter a valid option.") # runs if the answer is not valid

history.append(choice.upper()) # adds the choice the user picked


def getAnswer4(question, text):
loop = True
choice = ""

while loop == True:
print(question)
choice = input("Enter choice:"
"\nA = " + text["A"] +
"\nB = " + text["B"] +
"\nC = " + text["C"] +
"\nC = " + text["D"] +
"\n->")

if choice == "a" or choice == "A":
print("You have selected A: " + text[choice.upper()])
loop = False
elif choice == "b" or choice == "B":
print("You have selected B: " + text[choice.upper()])
loop = False
elif choice == "c" or choice == "C":
print("You have selected C: " + text[choice.upper()])
loop = False
elif choice == "d" or choice == "D":
print("You have selected D: " + text[choice.upper()])
loop = False
else:
print("Please enter a valid option.") # runs if the answer is not valid

history.append(choice.upper()) # adds the choice the user picked

# Main block
start()

question = "You are reading a magazine. The phone rings."

text = {"A": "Continue reading the magazine",
"B": "Inspect the room",
"C": "You pick up the phone"
}

getAnswer3(question, text)

print(history) # prints the history of choices made by the user

if history[1] == "A":
question = "You continue Archaeologist's Digest and read about how there's been a new discovery in Giza. How interesting. You can't read much further because the phone is still ringing. Loudly. "
text = {"A": "Answer"}
getAnswer1(question,text)
print(history)

0 comments on commit 4e18083

Please sign in to comment.