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

Mapa mental

Tuples

Suja Nair Inglês

Conteúdo do mapa

Tuples

  1. Definition

    • Immutable sequences
    • Used to store multiple items
  2. Creation

    • Using parentheses
      • Example: `my_tuple = (1, 2, 3)`
    • Using the `tuple()` constructor
      • Example: `my_tuple = tuple([1, 2, 3])`
  3. Tuple operation

    • Concatenation
      • Using `+` operator
        • Example: (1, 2) + (3, 4) results in (1, 2, 3, 4)
    • Replication
      • Using `*` operator
        • Syntax: `tuple_name * n`
  4. Modifying Tuples

    • Converting tuples to lists
      • Use list() function
  5. Built-in function

    • len()
      • Function that returns the number of items
        • Syntax: len(tuple)
    • tuple()
      • The tuple() constructor is used to create tuples. It can create an empty tuple or convert an iterable (like a list, string, or set) into a tuple.
    • count()
      • A method to count occurrences
      • Returns the number of times a value appears
        • Example tuple: (1, 2, 2, 3, 4)
          • count(2) returns 2
    • index()
      • A method used to find the first occurrence of a value
        • Syntax
          • Written as `tuple.index(value, start, end)`
        • Returns the index of the first occurrence of the value
    • sorted()
      • Used to sort iterables
      • Returns a new sorted list
      • Convert tuple to a list
      • Syntax
        • sorted(<iterable sequence>, [reverse=False])
    • min()
      • Returns the smallest element
        • Example: result = min(my_tuple)
    • max()
      • Returns the largest element
        • Example: result = max(my_tuple)
    • sum()
      • Calculates the total of numeric values
        • Example: sum((1, 2, 3)) returns 6
  6. Type of tuple

    • Single element tuple. eg. T= (12,)
    • Nested Tuple eg. T= (23, (45, 67, 88), 56, 78)
    • Empty tuple eg. T= ()

Informações

Descrição
Mapa Mental sobre Tuples, criado por Suja Nair em 17-05-2025.
Criado por
Suja Nair
Visualizações
0
Avaliação

Fale Conosco

Sobre o que é sua mensagem?

O que você acha do novo visual?

Você gostou?