So I have the following logic
athlete = True
#suppose that ath_name1, ath_name2 and ath_name3 are variables
if athlete == True:
if ath_name1 == 'player1':
footballer = True
elif ath_name2 == 'player1':
golfer = True
elif ath_name3 == 'player1':
runner = True
This works well but I was wondering if there is a more pythonic way of achieving the same using dictionary. Any help is greatly appreciated.
Aucun commentaire:
Enregistrer un commentaire