fork download
  1. # Assigning to tuples examples:
  2. a, b = (1, 2)
  3. print("a: ", a ," b:", b)
  4.  
  5. #tuple of length 1
  6. x = (3,)
  7. print("x:", x)
  8.  
  9. #extract the value from the one element tuple
  10. y, = x
  11. print("y:", y)
  12.  
  13. #This however is not a tuple
  14. z = (4)
  15. print("z:", z)
Success #stdin #stdout 0.02s 8688KB
stdin
Standard input is empty
stdout
a:  1  b: 2
x: (3,)
y: 3
z: 4