Basic tuple operations

Like lists, there are five basic tuple operations:

  • Concatenation
  • Repetition
  • Length
  • Membership
  • Iteration

Description

Expression

Results

 Iteration

 for x in (45,58,99) : print (x,end = ' ')

 45 58 99

 Repetition

 ('Python') * 3

 ('python', 'python', 'python')

 Length

 len(45, 58, 99, 65)

 4

 Concatenation

 (30, 50, 60) + ('Hello', 75, 66)

 (30,50,60,'Hello',75,66)

 Membership

 45 in (45,58,99,65)

 True

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset