O GoConqr está de visual novo! Conte para nós o que você achou.

Flashcards

List Methods

Ainagul Ermekova Inglês 10 flashcards

Flashcards do 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]

Informações

Descrição
FlashCards sobre List Methods, criado por Ainagul Ermekova em 07-01-2025.
Visualizações
1
Avaliação

Fale Conosco

Sobre o que é sua mensagem?

O que você acha do novo visual?

Você gostou?