def test_round(self):
        card_1 = Card("What is the capital of Alaska?", "Juneau", 'Geography')
        card_2 = Card("What is the square root of 169?", "13", 'STEM')
        card_3 = Card("What is the power house of the freaking cell?",
                      "Mitochondria", 'STEM')

        cards = [card_1, card_2, card_3]

        deck = Deck(cards)

        round = Round(deck)

        assert round.deck == deck

        assert round.turns == []

        assert round.current_card() == card_1

        new_turn = round.take_turn('Juneau')

        assert isinstance(new_turn, Turn)

        assert new_turn.correct() == True

        assert round.turns == [new_turn]

        assert round.number_correct() == 1

        assert round.current_card() == card_2

        newer_turn = round.take_turn('12')

        assert len(round.turns) == 2
        assert (round.total_turns()) == 2

        assert newer_turn.correct() == False

        assert newer_turn.feedback() == 'Incorrect.'

        assert round.number_correct() == 1

        assert round.number_correct_by_category('Geography') == 1
        assert round.number_correct_by_category('STEM') == 0

        assert round.percent_correct() == 50.0

        assert round.percent_correct_by_category('Geography') == 100.0
        assert round.percent_correct_by_category('STEM') == 0.0

        assert round.current_card() == card_3
class Test(unittest.TestCase):
    def setUp(self):
        self.card_1 = Card("Geography", "What is the capital of Alaska?",
                           "Juneau")
        self.card_2 = Card(
            "STEM",
            "The Viking spacecraft sent back to Earth photographs and reports about the surface of which planet?",
            "Mars")
        self.card_3 = Card(
            "STEM",
            "Describe in words the exact direction that is 697.5° clockwise from due north?",
            "North north west")
        self.deck = Deck([self.card_1, self.card_2, self.card_3])
        self.round = Round(self.deck)

    def test_it_has_attributes(self):
        self.assertEqual(self.round.deck, self.deck)
        expected = "What is the capital of Alaska?"
        self.assertEqual(self.round.deck.cards,
                         [self.card_1, self.card_2, self.card_3])
        self.assertEqual(self.round.deck.cards[0].question, expected)
        self.assertEqual(self.round.turns, [])

    def test_it_has_current_card(self):
        self.assertEqual(self.round.current_card, self.card_1)

    def test_it_can_take_turn(self):
        self.round.take_turn('Juneau')
        new_turn = self.round.turns[0]
        self.assertTrue(new_turn.correct())
        self.assertEqual(new_turn.feedback(), 'Correct')
        self.assertEqual(len(self.round.turns), 1)
        self.assertEqual(self.round.current_card, self.card_2)

        self.round.take_turn('Venus')
        new_turn2 = self.round.turns[1]
        self.assertFalse(new_turn2.correct())
        self.assertEqual(new_turn2.feedback(), 'Incorrect')
        self.assertEqual(len(self.round.turns), 2)
        self.assertEqual(self.round.current_card, self.card_3)

        self.round.take_turn('North north west')
        new_turn3 = self.round.turns[2]
        self.assertTrue(new_turn3.correct())
        self.assertEqual(new_turn3.feedback(), 'Correct')
        self.assertEqual(len(self.round.turns), 3)
        self.assertEqual(self.round.current_card, 'No More Cards')

    def test_it_can_calculate_number_correct(self):
        self.round.take_turn('Juneau')
        self.round.take_turn('Venus')
        self.assertEqual(self.round.number_correct(), 1)

    def test_it_can_calculate_number_correct_by_category(self):
        self.round.take_turn('Ohio')
        self.round.take_turn('Mars')
        self.round.take_turn('North north west')
        self.assertEqual(self.round.number_correct_by_category('STEM'), 2)
        self.assertEqual(self.round.number_correct_by_category('Geography'), 0)

    def test_it_can_calculate_percent_correct(self):
        self.round.take_turn('Ohio')
        self.round.take_turn('Mars')
        self.round.take_turn('North north west')
        self.assertEqual(self.round.percent_correct(), 66.67)

    def test_it_can_calculate_turns_by_category(self):
        self.round.take_turn('Ohio')
        self.round.take_turn('Mars')
        self.round.take_turn('North north west')
        self.assertEqual(self.round.turns_by_category('Geography'), 1)
        self.assertEqual(self.round.turns_by_category('STEM'), 2)

    def test_it_can_calculate_percent_correct_by_category(self):
        self.round.take_turn('Ohio')
        self.round.take_turn('Mars')
        self.round.take_turn('North north west')
        self.assertEqual(self.round.percent_correct_by_category('Geography'),
                         0.00)
        self.assertEqual(self.round.percent_correct_by_category('STEM'),
                         100.00)
round = Round(deck)
total_cards = len(cards)
categories = deck.all_categories()

intro = "Welcome to Flashcards! You are playing with %s cards" % total_cards
print(intro)

while len(cards) > 0:
  print('*-*-*-*-*-*-*-*-*-*-*-*-*-*-*')
  print('This is card number %s out of %s' % (total_cards - len(cards) + 1, total_cards))
  print('Question: %s' % round.current_card().question)

  guess = input('>>').lower()
  
  guess = round.take_turn(guess)
  answer = guess.card.answer

  print("%s" % round.turns[-1].feedback())


  if guess.correct() == False:
    print('The answer is %s' % answer)

print("****** Game over! ******")
print("Here is how you did overall:")
print('You had %s guesses correct out of %s questions for an overall score of %s' % (round.number_correct(), total_cards, round.percent_correct()))
print('------------------------------')
print('Here is how you did by category:')

for category in categories:
  print('%s: %s' % (category, round.percent_correct_by_category(category)))