I am new to python. I am learning list comprehension to shorten my code to minimum. But I am unable to incremnent inside a list comprehension. Like this code:
n = 0; c = 0
for i in range(input()):
m = map(int,raw_input().split())
[n+=1 if m[0] > m[1] else c+=1]
print ['N'. 'C'][c > n]
My input:
3
3 4
2 4
2 5
The output should be:
N
Aucun commentaire:
Enregistrer un commentaire