This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 1. Написать функцию, которая получает в виде параметра имя файла названия | |
| # интернет доменов (domains.txt) | |
| # и возвращает их в виде списка строк (названия возвращать без точки). | |
| def get_domains(filename): | |
| """ | |
| Функция возвращает название интернет доменов | |
| :param filename: строка с именем файла | |
| :return: список |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 1. Дан список строк my_list. Создать новый список в который поместить | |
| # элементы из my_list по следующему правилу: | |
| # Если строка стоит на нечетном месте в my_list, то ее заменить на | |
| # перевернутую строку. "qwe" на "ewq". | |
| # Если на четном - оставить без изменения. | |
| # Задание сделать с использованием enumerate или range. | |
| my_list = ["Это", "просто", "пример", "списка", "123", "456"] | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from timeit import timeit | |
| print("list() = ", timeit("list()")) | |
| print("[]", timeit("[]")) | |
| my_list = list() | |
| my_second_list = [] | |
| my_dict = dict() | |
| my_second_dict = {} |
NewerOlder