¡GoConqr estrena diseño! Cuéntanos qué te parece.

Fichas

List Methods

Ainagul Ermekova Inglés 10 fichas

Fichas del conjunto (10)

  1. 11.Check that x is not in lst listif x not in lst
  2. 2List lst repeated n timesprint (lst * n)
    lst *= n
  3. 3Sum of list elements (for numeric values)sum(lst)
  4. 41.Add x to the end of the lst list 2.Insert element x at position lst[i]. Elements to the right of the insertion change index to i + 1lst.append(x)
    lst.insert(i, x)
  5. 5lst1 = [2, 7] lst2 = [4, 6] lst1.extend(lst2) print(lst1)[2, 7, 4, 6]
    The elements of the list lst2 are added to the end of the list lst1, i.e. list expansion lst1
  6. 6lst=[4,8,9] Removes the 2-th element of the listdel lst[2]
  7. 7nums = [9, 7, 4, 6] del nums[:2] print(nums)[4, 6]
  8. 8Delete the first occurrence of x in lst, in case x not in lst - an errorlst.remove(x)
  9. 9nums = [9, 7, 4, 6] nums.reverse() print(nums)[6, 4, 7, 9]
  10. 101.nums = [9, 7, 4, 6] nums.sort(reverse=True) print(nums) 2.nums = [9, 7, 4, 6] nums.sort() print(nums)1. [9, 7, 6, 4]
    Sort the list in descending order
    2.[4, 6, 7, 9]

Información

Descripción
Fichas sobre List Methods, creado por Ainagul Ermekova el 07/01/2025.
Visitas
1
Valoración

Escríbenos

¿Sobre qué es tu mensaje?

¿Qué te parece el nuevo diseño?

¿Te gusta?