-
Notifications
You must be signed in to change notification settings - Fork 0
/
task1.py
75 lines (63 loc) · 1.79 KB
/
task1.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# Task 1
from datetime import datetime
# Our data structure
dataStructure = []
while True:
volunteerArea = ""
dateJoined = ""
name = input("Enter name: ")
while True:
isVolunteer = input("Is the person a volunteer? (y/n): ")
if isVolunteer == "y":
while True:
print("1.Gate 2.Shop 3.Painting")
volunteerArea = input("Enter volunteer area: ")
if volunteerArea=="1" or volunteerArea=="2" or volunteerArea=="3":
break;
else:
print("Invalid input")
continue;
break;
elif isVolunteer == "n":
break;
else:
print("Invalid input")
continue
while True:
try:
dateJoinedInput = input("Enter date joined: ")
dateJoined = datetime.strptime(dateJoinedInput, '%d/%m/%Y')
break;
except:
print("Invalid date format error")
continue;
while True:
isFeepaid = input("Has the person paid the fee? (y/n): ")
if isFeepaid == "y":
break;
elif isFeepaid == "n":
break;
else:
print("Invalid input")
continue;
dataStructure.append({
"name": name,
"isVolunteer": isVolunteer,
"volunteerArea": volunteerArea,
"dateJoined": dateJoined,
"isFeepaid": isFeepaid
})
while True:
addMore = input("Add another person? (y/n): ")
if addMore == "y":
break;
elif addMore == "n":
break;
else:
print("Invalid input")
continue;
if addMore == "n":
break;
else:
continue;
print(dataStructure)