PYTHON : LISTS


  1. #!/usr/bin/evn python

  2. list1 = ['physics', 'chemistry', 1997, 2000];
  3. list2 = [1, 2, 3, 4, 5, 6, 7 ];

  4. print(list1[2]) -1997
  5. print(list1[-2]) -1997
  6. print(list1[1:5]) -['chemistry', 1997, 2000]
  7. print(list1[2:]) -[1997, 2000]

  8. del list2[2:4]
  9. print(list2) -[1, 2, 5, 6, 7]

Python - Lists/IN FULL DETAILS

Post a Comment

If you have any doubts, please let me know

Previous Post Next Post