Voting age
In the code below, we have dictionaries storing data about different people. Write a function can_vote that receives such a dictionary as input and returns
True
if the person has reached the minimum voting age min_age and False
otherwise.min_age = 18
alice = { 'age': 18, 'gender': 'female'}
bob = { 'age': 40, 'gender': 'male'}
charlotte = { 'age': 17, 'gender': 'female'}
# define function can_vote here...
print(can_vote(alice)) # expected output: True
print(can_vote(bob)) # expected output: True
print(can_vote(charlotte)) # expected output: False
Python
Setting up Python environment...
Output