Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I am gonna ask you to do this output { ' Special Special Prize': 0 , 'Special Prize': 1 , 'First Prize': 0 , 'Second
I am gonna ask you to do this output
Special Special Prize': 'Special Prize': 'First Prize': 'Second Prize': 'Third
Prize': 'Fourth Prize': 'Fifth Prize': 'Sixth prize': No prize':
Note: Sixth Prize Third Prize Special Prize
This is my code
def countprizesinvoice:
# Define the prize lists
num
specialprizenum num # Special Award num
specialprizenum num # Special Prize num
jackpotnum num # Jackpot num
prizecounts
'Special Special Prize':
'Special Prize':
'First Prize':
'Second Prize':
'Third Prize':
'Fourth Prize':
'Fifth Prize':
'Sixth prize':
No prize':
# Count prizes for each invoice
for ticket in invoice:
if ticket specialprizenum:
prizecountsSpecial Prize'
elif ticket specialprizenum:
prizecountsSpecial Prize'
elif ticket jackpotnum:
prizecountsFirst Prize'
elif ticket: jackpotnum::
prizecountsSecond Prize'
elif ticket: jackpotnum::
prizecountsThird Prize'
elif ticket: jackpotnum::
prizecountsFourth Prize'
elif ticket: jackpotnum::
prizecountsFifth Prize'
elif ticket: jackpotnum::
prizecountsSixth prize'
else:
prizecountsNo prize'
return prizecounts
# Example usage
invoices
prizecounts countprizesinvoices
printprizecounts
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started