Pythoni korteežite korrutamine
Korteeže saame samuti korrutada, st. kopeerida
neid kindla arv kordi. Seda tehakse
operaatori * abil:
tpl = ('a', 'b')
res = tpl * 2
print(res) # väljastab ('a', 'b', 'a', 'b')
Antud korteež:
tpl1 = ('1', '2', '3')
Loo sellest järgmine korteež:
tpl2 = ('1', '2', '3', '1', '2', '3', '1', '2', '3')
Antud korteežid:
tpl1 = ('a', 'b')
tpl2 = (1, 2)
Kirjuta kood, et saada järgmine korteež:
tpl3 = ('a', 'b', 'a', 'b', 1, 2)