add the total winnings output
This commit is contained in:
parent
4327f7bd8c
commit
c136e9c835
|
|
@ -50,6 +50,9 @@ class Ticket:
|
|||
self.winnings = wins[self.multiplier][len(self.matched_numbers)]
|
||||
self.output_ticket()
|
||||
|
||||
def get_ticket_winnings(self):
|
||||
return self.winnings
|
||||
|
||||
def output_ticket(self):
|
||||
special_ball = self.special_ball_name
|
||||
print(f'Winning Numbers: {self.winning_numbers}')
|
||||
|
|
|
|||
|
|
@ -5,9 +5,13 @@ from .MegaMillions import MegaMillions
|
|||
|
||||
cur_picks = []
|
||||
cur_pb = 0
|
||||
winnings = 0
|
||||
|
||||
for idx, tkt in enumerate(my_picks):
|
||||
cur_picks = tkt['picks']
|
||||
cur_pb = tkt['mb']
|
||||
pbtkt = MegaMillions(cur_picks, cur_pb)
|
||||
pbtkt.process_ticket()
|
||||
winnings += pbtkt.get_ticket_winnings()
|
||||
|
||||
print("Total Winnings:", winnings)
|
||||
|
|
|
|||
4
play.py
4
play.py
|
|
@ -6,7 +6,6 @@ import importlib
|
|||
|
||||
|
||||
def main(argv):
|
||||
game = ''
|
||||
usage = 'play.py -g <gamename>'
|
||||
|
||||
try:
|
||||
|
|
@ -19,8 +18,7 @@ def main(argv):
|
|||
print(usage)
|
||||
sys.exit()
|
||||
elif opt in ("-g", "--game"):
|
||||
game = arg
|
||||
importlib.import_module(f'{game}.game')
|
||||
importlib.import_module(f'{arg}.game')
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
|
|||
|
|
@ -5,9 +5,13 @@ from .Powerball import Powerball
|
|||
|
||||
cur_picks = []
|
||||
cur_pb = 0
|
||||
winnings = 0
|
||||
|
||||
for idx, tkt in enumerate(my_picks):
|
||||
cur_picks = tkt['picks']
|
||||
cur_pb = tkt['pb']
|
||||
pbtkt = Powerball(cur_picks, cur_pb)
|
||||
pbtkt.process_ticket()
|
||||
winnings += pbtkt.get_ticket_winnings()
|
||||
|
||||
print("Total Winnings:", winnings)
|
||||
|
|
|
|||
Loading…
Reference in a new issue