py-repo

a python playground
Index Commits Files Refs README
lists2.py (531B)
   1 
   2 lucky_numbers = [4, 8, 15, 16, 23, 42, 18]
   3 friends = ["Kevin", "Karen", "Jim", "Jim", "Oscar", "Tom"]
   4 friends2 = friends.copy()
   5 
   6 print(friends)
   7 print(friends2)
   8 
   9 print(friends.index("Oscar"))
  10 print(friends.count("Jim"))
  11 
  12 friends.append("Mike")
  13 print(friends)
  14 
  15 friends.insert(1, "Kelly")
  16 print(friends)
  17 
  18 friends.remove("Mike")
  19 print(friends)
  20 
  21 friends.pop()
  22 
  23 friends.extend(lucky_numbers)
  24 print(friends)
  25 
  26 friends.clear()
  27 
  28 print(lucky_numbers)
  29 lucky_numbers.sort()
  30 print(lucky_numbers)
  31 
  32 lucky_numbers.reverse()
  33 print(lucky_numbers)
  34 
  35