Example #1
0
def main():
    playing = True
    while playing:
        price = choose_random_price(prices)
        print(f'\nThe Purchase Price is ${price}.')
        payment = enter_payment(price)
        diff = calc_difference(price, payment)
        results = calc_change(diff)
        print_results(diff, results)
        playing = play_again()
Example #2
0
 def test_input_n(self, mock_input):
     play = play_again()
     self.assertEqual(play, False)
     self.assertEqual(sys.stdout.getvalue().strip(), "Thanks for playing!!")
Example #3
0
 def test_input_invlaid_space(self, mock_input):
     play = play_again()
     self.assertEqual(sys.stdout.getvalue().strip(),
                      "Please enter 'Y' or 'N'.")
     self.assertEqual(play, True)
Example #4
0
 def test_input_y(self, mock_input):
     play = play_again()
     self.assertEqual(play, True)