-
Notifications
You must be signed in to change notification settings - Fork 0
/
exercise094.py
30 lines (27 loc) · 955 Bytes
/
exercise094.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
person = dict()
info, names, nquantity, ages, women, above = list(
), list(), list(), list(), list(), list()
while True:
person['name'] = input("Name: \n")
gender = input("Gender [M/F]: \n")
gender = gender[0].upper()
person['gender'] = gender
person['age'] = float(input("Age: \n"))
info.append(person.copy())
leave = input("Continue? [Y/N] \n")
leave = leave.upper()
if leave[0] == "N":
break
for dictionary in info:
nquantity.append(dictionary.get("name"))
ages.append(dictionary.get("age"))
age = sum(ages)/len(ages)
for key, value in dictionary.items():
if value == "F":
women.append(dictionary.get("name"))
if dictionary.get("age") > (age):
above.append(dictionary.get("name"))
print(f"Registered people: {len(nquantity)}")
print(f"Average age of the group: {age:.1f} anos.")
print(f"Group women: {women}")
print(f"People over the average age: {above}")