Пример #1
0
 def test_check_true(self):
     test = Retry.check_if_exit(True)
     self.assertFalse(test)
Пример #2
0
 def test_check_exit(self):
     with self.assertRaises(SystemExit) as test:
         Retry.check_if_exit(False)
     self.assertEqual(test.exception.code, 0)
Пример #3
0
    gr.setup()

    while True:
        UpdateDis = UpdateDisplay(word_check, tried)
        # called to show how many letters are in word object
        print(UpdateDis.update_ans_dis())
        print(f"you have tried: {UpdateDis.update_try_dis()}")
        guess = input("guess a letter: ")

        if guess == '':
            print("you need to put an answer\n")
            continue

        elif guess == "quit" or guess == "exit":
            Retry.check_if_exit(False)

        elif guess in tried:
            print(f"{guess} has allready been tried")

        elif len(guess) > 1:
            print("you must imput only one letter\n")
            continue  # jumps to begining of loop for user input

        elif guess in word:
            # holds the index of every instance that the letter is in the word
            letter_index = []
            count = 0  # used to represent the index

            # finds every location that letter is in the word
            for letter in word: