I'm facing issue with nested one line conditional statement while there is a assignment operation.
bob = list(map(int, input().split())) print(alice, bob) a, b = 0 for i in range(3): a+=1 if alice[i]>bob[i] else (b+=1 if alice[i]<bob[i] else 1) print(a,b)``` Output: <br/> File "/home/Algorithms/compare_triplets.py", line 6 a+=1 if alice[i]>bob[i] else b=b+1 if alice[i]<bob[i] else 1
https://stackoverflow.com/questions/66740166/stuck-with-python-if-else-one-line-statement March 22, 2021 at 11:58AM
没有评论:
发表评论