“Exemple de tuple Python” Réponses codées

Tuplein Python

a=(1,2,3,4)
print(a[-3])

Coder Cat

Exemple de tuple Python

# Creating a Tuple with
# the use of Strings
Tuple = ('Geeks', 'For')
print("\nTuple with the use of String: ")
print(Tuple)
      
# Creating a Tuple with
# the use of list
list1 = [1, 2, 4, 5, 6]
print("\nTuple using List: ")
Tuple = tuple(list1)
  
# Accessing element using indexing
print("First element of tuple")
print(Tuple[0])
  
# Accessing element from last
# negative indexing
print("\nLast element of tuple")
print(Tuple[-1])
  
print("\nThird last element of tuple")
print(Tuple[-3])
No Name

Tuples en python

  strs = ['ccc', 'aaaa', 'd', 'bb']  print sorted(strs, key=len)  ## ['d', 'bb', 'ccc', 'aaaa']
 #the list will be sorted by the length of each argument
Happy Heron

tuple python

tupel python
Ma

tuple en python

name_of_students = ("Jim" , "yeasin" , "Arafat")
print(name_of_students.index('Arafat'))
YEASIN ARAFAT

Python créant un tuple

# Different types of tuples

# Empty tuple
my_tuple = ()
print(my_tuple)

# Tuple having integers
my_tuple = (1, 2, 3)
print(my_tuple)

# tuple with mixed datatypes
my_tuple = (1, "Hello", 3.4)
print(my_tuple)

# nested tuple
my_tuple = ("mouse", [8, 4, 6], (1, 2, 3))
print(my_tuple)
SAMER SAEID

Réponses similaires à “Exemple de tuple Python”

Questions similaires à “Exemple de tuple Python”

Plus de réponses similaires à “Exemple de tuple Python” dans Python

Parcourir les réponses de code populaires par langue

Parcourir d'autres langages de code