Python obejmuje ćwiczenia 70
Tytuł: Napisz funkcję, należy znaleźć długość łańcucha, wprowadź ciąg w głównej funkcji, i wysyła jego długość.
Program Analysis: Brak.
Kod źródłowy:
#!/usr/bin/python # -*- coding: UTF-8 -*- if __name__ == '__main__': s = raw_input('please input a string:\n') print 'the string has %d characters.' % len(s)
Powyższy przykład wyjście jest:
please input a string: abc the string has 3 characters.