-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy path1-python-question.py
51 lines (39 loc) · 1.1 KB
/
1-python-question.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# This program simualtes the backend of a ticket purchasing system
# Price per visitor is $5
# Price per member is $3.50
# You are to do the following
# 1. Identify all banned visitors with a filter call
# 2. Determine the memberships status of all applicants
# 3. Calculate the total price for all eligible visitors
# 4. For each valid visitor, return a corresponding ticket in Dictionary form
# 5. Return an error via thrown exception if applicants is empty
# Complete everything above in a function called processRequest
# Your should abstract out function as much as reasonably possible
bannedVisitors = ["Amy", "Grace", "Bruce"]
memberStatus = {
"Ally": True,
"David": True,
"Brendan": False
}
request = {
"applicants": ["Amy", "Ally", "David", "Brendan", "Zoho"]
}
def processRequest(request):
# Your code here
return
print(processRequest(request))
# {
# successfulApplicants:
# bannedApplicatns:
# totalCost:
# tickets: [
# {
# "name": ,
# "membershipStatus": ,
# "price":
# }, ....
# ]
#
# }
# OR
# {"error": "No applicants"}