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

Módulo 3 de 5 · Texto

Sem título

Bhavuk kumar

Important Topics Continue:

3. Lists : 
- lists of files in a folder, employees in a company, emails in your inbox, and so on.
- Python’s lists may be reminiscent of arrays in other languages, but they tend to be more powerful.
- Further, lists have no fixed size. That is, they can grow and shrink on demand, in response to list-specific operations:

>>> L = [123, 'spam', 1.23]   # A list of three different-type objects
>>> len(L)                               # Number of items in the list
3

>>> L[0]                                 # Indexing by position
123
>>> L[:-1]                               # Slicing a list returns a new list
[123, 'spam']
>>> L + [4, 5, 6]                      # Concat/repeat make new lists too
[123, 'spam', 1.23, 4, 5, 6]
>>> L * 2
[123, 'spam', 1.23, 123, 'spam', 1.23]
>>> L                                       # We're not changing the original list
[123, 'spam', 1.23]

>>> L.append('NI')                # Growing: add object at end of list
>>> L
[123, 'spam', 1.23, 'NI']
>>> L.pop(2)                           # Shrinking: delete an item in the middle
1.23
>>> L                                        # "del L[2]" deletes from a list too
[123, 'spam', 'NI']

>>> M = ['bb', 'aa', 'cc']
>>> M.sort()
>>> M
['aa', 'bb', 'cc']
>>> M.reverse()
>>> M
['cc', 'bb', 'aa']>>> M = ['bb', 'aa', 'cc']
>>> M.sort()
>>> M
['aa', 'bb', 'cc']
>>> M.reverse()
>>> M
['cc', 'bb', 'aa']

 

 

Instruções

Para avançar no curso, envie uma tentativa deste quiz. Você pode enviá-la depois da última pergunta.

Ir para o módulo escolhido

Fale Conosco

Sobre o que é sua mensagem?

O que você acha do novo visual?

Você gostou?