def translationQuestion(self, word, letter=None, score=1): if self.exit is False: if letter is not None: self.displayQuestionLetter(letter) textIn = input( inout.coloured( "What is '{}' in English? ".format(word.translation), 'cyan', True)).lower() if textIn == "exit": self.exit = True elif textIn == word.english: print(inout.coloured("Correct!", 'green')) self.score += score else: print( inout.coloured( "Incorrect! The answer was " + word.english + ".", 'red')) if len(textIn) > 0: inout.remove_history_items(1)
def pastParticipleQuestion(self, verb, letter=None, score=1): if self.exit is False: if letter is not None: self.displayQuestionLetter(letter) textIn = input( inout.coloured( "What is the past participle of '" + verb.translation + "'? ", 'cyan', True)).lower() if textIn == 'exit': self.exit = True elif textIn == verb.pastParticiple: print(inout.coloured("Correct!", 'green')) self.score += score else: print( inout.coloured( "Incorrect! The answer was " + verb.pastParticiple + ".", 'red')) if len(textIn) > 0: inout.remove_history_items(1)
def genderQuestion(self, noun, letter=None, score=1): if self.exit is False: if letter is not None: self.displayQuestionLetter(letter) textIn = input( inout.coloured( "What is the gender of '" + noun.translation + "'? ", 'cyan', True)).lower() if textIn == 'exit': self.exit = True elif textIn == noun.gender: print(inout.coloured("Correct!", 'green')) self.score += score else: print( inout.coloured( "Incorrect! The answer was " + noun.gender + ".", 'red')) if len(textIn) > 0: inout.remove_history_items(1)
def auxiliaryVerbQuestion(self, verb, letter=None, score=1): auxiliaryVerbs = ['haben', 'sein'] if verb.language == 'german' else [ 'avoir', 'être' ] # Shift-AltGr-6 release e for ê if self.exit is False: if letter is not None: self.displayQuestionLetter(letter) textIn = input( inout.coloured( "Does '" + verb.pastParticiple + "' use " + auxiliaryVerbs[0] + " or " + auxiliaryVerbs[1] + "? ", 'cyan', True)).lower() if textIn == 'exit': self.exit = True elif textIn == verb.auxVerb: print(inout.coloured("Correct!", 'green')) self.score += score else: print( inout.coloured( "Incorrect! The answer was " + verb.auxVerb + ".", 'red')) if len(textIn) > 0: inout.remove_history_items(1)
running = True try: while running: action = input(inout.coloured("What would you like to do? ", 'blue', True)).lower() if len(action) > 0: if action == 'add word': english = input(inout.coloured("What is the word in English? ", 'magenta', True)).lower() language = input(inout.coloured("What language? ", 'magenta', True)).lower() translation = input(inout.coloured("What is the word in " + language + "? ", 'magenta', True)).lower() topic = input(inout.coloured("What topic is this word in? ", 'magenta', True)).lower() type = input(inout.coloured("What type of word is this? ", 'magenta', True)).lower() if type == 'noun': gender = input(inout.coloured("What is the gender of this noun? ", 'magenta', True)).lower() inout.remove_history_items(6) add_noun(english, language, translation, gender, topic) elif type == 'verb': pastParticiple = input(inout.coloured("What is the past participle of this verb? ", 'magenta', True)).lower() auxVerb = input(inout.coloured("What auxiliary verb does this verb use? ", 'magenta', True)).lower() inout.remove_history_items(7) add_verb(english, language, translation, pastParticiple, auxVerb, topic) elif type == 'adjective': inout.remove_history_items(5) add_adjective(english, language, translation, topic) elif action.split()[0] == 'quiz': # needs type and topic and possible limit if len(action.split()) < 3:
def eraseFromMemory(self): inout.remove_history_items(1)