Tableau inversé avec Python[3scientifique]

       Ecrire un programme Python qui permet de remplir un tableau T avec n noms puis d’afficher ce tableau dans le sens inverse.0.

Code Python

from numpy import array
n = int(input("Donner la taille du tableau: "))
T = array([str()]*n)
for i in range(n):
    T[i] = input("Donner l'élément",i," : ")
for i in range(n):
    S = T[i]
    T[i] = T[n-i-1]
    T[n-i-1] = S
for i in range(n):
    print(T[i], end=' ')

Leave a Reply

Your email address will not be published. Required fields are marked *