String-verdelings in Python
splitrsplitpartitionrpartitionjoinЗадание 1
Gegee 'n string:
pythontxt = 'a/b/c/d'
Skryf kode om die volgende resultaat te kry:
python['a', 'b', 'c', 'd']
Задание 2
Gegee 'n string:
pythontxt = 'a.b.c.d'
Skryf kode om die volgende resultaat te kry:
python['a.b.c', 'd']
Задание 3
Gegee 'n string:
pythontxt = 'ab%cd%'
Skryf kode om die volgende resultaat te kry:
python('ab', '%', 'cd%')
Задание 4
Gegee 'n string:
pythontxt = '2025-12-31'
Skryf kode om die volgende resultaat te kry:
python('2025-12', '-', '31')
Задание 5
Gegee 'n string:
pythontxt = '2025-12-31'
Skryf kode om die volgende resultaat te kry:
python('2025-12', '-', '31')
Задание 6
Gegee 'n lys:
pythonlst = ['a', 'b', 'c', 'd']
Skryf kode om die volgende string te kry:
python'abcd'
Задание 7
Gegee 'n lys:
pythonlst = ['2025', '31', '12']
Skryf kode om die volgende string te kry:
python'2025/31/12'
Задание 8
Gegee 'n lys:
pythonlst = [1, 2, 3]
Skryf kode om die volgende string te kry:
python'123'