ответвлено от main/python-labs
Merge branch 'main' of http://uit.mpei.ru/git/ZhalninVY/python-labs
Этот коммит содержится в:
@@ -167,14 +167,17 @@ NameError: name 'kort8' is not defined. Did you mean: 'kort7'?
|
||||
|
||||
Создание строки со своей фамилией и инициалами, преобразование её в список, затем список – в кортеж и, наконец, кортеж – в строку. .
|
||||
```python
|
||||
>>>fam = list('Zhalnin VY')
|
||||
>>>fam
|
||||
>>>fio = "Zhalnin VY"
|
||||
>>>fio
|
||||
"Zhalnin VY"
|
||||
>>>fio_list = list(fio)
|
||||
>>>fio_list
|
||||
['Z', 'h', 'a', 'l', 'n', 'i', 'n', ' ', 'V', 'Y']
|
||||
>>>kort = tuple(fam)
|
||||
>>>kort
|
||||
>>>fio_tuple = tuple(fio_list)
|
||||
>>>fio_tuple
|
||||
('Z', 'h', 'a', 'l', 'n', 'i', 'n', ' ', 'V', 'Y')
|
||||
>>>strk = str(kort)
|
||||
>>>strk
|
||||
>>>fio_string = str(fio_tuple)
|
||||
>>>fio_string
|
||||
"('Z', 'h', 'a', 'l', 'n', 'i', 'n', ' ', 'V', 'Y')"
|
||||
```
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
|
||||
## Решение
|
||||
```python
|
||||
>>>vosm = "45"
|
||||
>>>celoe = int(vosm, 8)
|
||||
>>>celoe
|
||||
37
|
||||
|
||||
Ссылка в новой задаче
Block a user