I want to make a discount of 31% to all users under 25 years and 50% to users over 40 years.
On the other side to users who do not live in Madrid only a discount of 5%.
students = [
('Marcos', 23, 'Madrid', 850, '2388711341'),
('Elena', 35, 'Madrid', 360, '0387700342'),
('Carmen', 21, 'Getafe', 50, '0014871388'),
('Carlos', 41, 'Madrid', 580, '00887118456'),
('Maria', 28, 'Madrid', 150, '587')
]
for item in students:
student, age, city, debt, id = item
if age < 25
else debt * 0.69
if age > 40
else debt * 0.5
if city is not 'Madrid'
else debt * 0.95
print(f'Name: {student} - Debt: {debt}')
Print Example: Name: Marcos - Debt: 586,5
Name: Elena - Debt: 360
Name: Carmen - Debt: 47,5
Name: Carlos - Debt: 290
Name: Maria - Debt: 150