Python-da setiriň uzynlygy

Setir simwollarynyň sany (onuň uzynlygy) len funksiýasy arkaly tapyp bolýar:

pythonprint(len('abc')) # 3 çap eder

Setir üýtgeýjide hem saklanyp bilner:

pythontxt = 'abc'
print(len(txt))

Boşluk hem bir simwoldyr:

pythontxt = 'ab c'
print(len(txt)) # 4 çap eder
Задание 1

Setir berlen:

pythontxt = 'abcdef'

Bu setiriň uzynlygyny konsola çap ediň.

Задание 2

Setir berlen:

pythontxt = 'ab cd ef'

Bu setiriň uzynlygyny konsola çap ediň.