Le slice complet en Python

Pour obtenir un slice entièrement complet, on peut appliquer l'opérateur [:] :

pythontxt = 'abcde'
res = txt[:]

print(res) # affichera 'abcde'

De tels slices peuvent être nécessaires pour copier l'objet source. Copions notre chaîne à l'aide d'un slice :

pythontxt1 = 'abcde'
txt2 = txt1[:]

print(txt2) # affichera 'abcde'
Задание 1

Soit une liste :

pythonlst = [1, 2, 3]

Copiez-la.

Задание 2

Soit un nombre :

pythonnum = 4567

Écrivez un code pour obtenir le résultat suivant :

python'4567'