Problèmes comparaison "int" "list"

Fermé
vicgrgn - 11 févr. 2021 à 20:40
Whismeril Messages postés 19028 Date d'inscription mardi 11 mars 2003 Statut Non membre Dernière intervention 24 avril 2024 - 11 févr. 2021 à 21:23
Bonjour ,j'ai un programme à faire est à la ligne 11 j'ai une erreur qui est
( if int(ageParticipant[2]) > age:
TypeError: '>' not supported between instances of 'int' and 'list')

si quelqu'un peut me dire comment ne plus avoir cette erreur
Merci d'avance

1. source= open("C:\\Users\\Megaport\\Downloads\\jo.csv","r")
2. data = source.read()
3. lignes = data.split("\n")
4. lignes = lignes[1:]
5. lignesDetails = []

6. for ligne in lignes:
7. lignesDetails.append(ligne.split(","))

8. age = 0
9. ligneAge = []

10. for ageParticipant in lignesDetails:
11. if int(ageParticipant[2]) > age:
12. age = ageParticipant
13. ligneAge.append(ageParticipant)
A voir également:

1 réponse

Whismeril Messages postés 19028 Date d'inscription mardi 11 mars 2003 Statut Non membre Dernière intervention 24 avril 2024 931
11 févr. 2021 à 21:23
Bonsoir

pour poster ton code, il faut faire comme décrit là https://codes-sources.commentcamarche.net/faq/11288-les-balises-de-code

Après on pourra commencer à t'aider.
0