Konvertierung eines Tupels in eine Liste in Python
Um aus einem Tupel eine Liste zu machen, muss man
die Funktion list anwenden:
pythontpl = ('a', 'b', 'c')
res = list(tpl)
print(res) # gibt ['a', 'b', 'c'] aus
Задание 1
Gegeben ist das Tupel:
pythontpl = ('2', '6', '12')
Machen Sie daraus eine Liste.
Задание 2
Gegeben sind die Tupel:
pythontpl1 = ('1', '2', '3')
tpl2 = ('4', '5')
Erstellen Sie daraus die folgende Liste:
python['1', '2', '3', '4', '5']
Задание 3
Gegeben ist das Tupel:
pythontpl = (1, 2, 3, 4, 5)
Drehen Sie es um:
python(5, 4, 3, 2, 1)