Basic list operations

There are five basic list operations:

  • Concatenation
  • Repetition
  • Length
  • Membership
  • Iteration

Description

Expression

Result

 Concatenation

 [30, 50, 60] + ['Hello', 75, 66]

 [30,50,60,'Hello',75,66]

 Membership

 45 in [45,58,99,65]

 True

 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

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

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