Advertisement
tungSfer

danh sach tuple

Jan 16th, 2022
281
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.35 KB | None | 0 0
  1. res = []
  2. for _ in range(int(input())):
  3.     a = [int(i) for i in input().split()]
  4.     ok = True
  5.     for i in res:
  6.         if a[0] == i[0]:
  7.             i.extend(a[1:])
  8.             ok = False
  9.     if ok :
  10.         res.append(a)
  11. for i in range(len(res)):
  12.     res[i] = tuple(res[i])
  13. print(res)
  14.  
  15. '''
  16. 4
  17. 5 6
  18. 5 7
  19. 5 8
  20. 6 5 8 7
  21.  
  22. 3
  23. 6 7
  24. 6 10
  25. 6 8
  26. '''
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement