├── .github └── workflows │ └── Docker.yml ├── .gitignore ├── .markdownlint.json ├── .yamllint ├── Dockerfile ├── Makefile ├── README.md ├── bin └── test.sh ├── description.en.yml ├── description.es.yml ├── description.ru.yml ├── docker-compose.override.yml ├── docker-compose.yml ├── modules ├── 10-basics │ ├── 10-hello-world │ │ ├── Makefile │ │ ├── description.es.yml │ │ ├── en │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── es │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── index.py │ │ ├── ru │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ └── test_code.py │ ├── 20-comments │ │ ├── Makefile │ │ ├── description.es.yml │ │ ├── en │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── es │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── index.py │ │ ├── ru │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ └── test_code.py │ ├── 30-instructions │ │ ├── Makefile │ │ ├── description.es.yml │ │ ├── en │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── es │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── index.py │ │ ├── ru │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ └── test_code.py │ ├── 40-testing │ │ ├── Makefile │ │ ├── description.es.yml │ │ ├── en │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── es │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── index.py │ │ ├── ru │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ └── test_code.py │ ├── 50-syntax-errors │ │ ├── Makefile │ │ ├── description.es.yml │ │ ├── en │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── es │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── index.py │ │ ├── ru │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ └── test_code.py │ ├── description.en.yml │ ├── description.es.yml │ └── description.ru.yml ├── 20-arithmetics │ ├── 20-basic │ │ ├── Makefile │ │ ├── description.es.yml │ │ ├── en │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── es │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── index.py │ │ ├── ru │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ └── test_code.py │ ├── 25-operator │ │ ├── Makefile │ │ ├── description.es.yml │ │ ├── en │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── es │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── index.py │ │ ├── ru │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ └── test_code.py │ ├── 27-commutativity │ │ ├── Makefile │ │ ├── description.es.yml │ │ ├── en │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── es │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── index.py │ │ ├── ru │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ └── test_code.py │ ├── 30-composition │ │ ├── Makefile │ │ ├── description.es.yml │ │ ├── en │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── es │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── index.py │ │ ├── ru │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ └── test_code.py │ ├── 40-priority │ │ ├── Makefile │ │ ├── description.es.yml │ │ ├── en │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── es │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── index.py │ │ ├── ru │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ └── test_code.py │ ├── 43-float │ │ ├── Makefile │ │ ├── description.es.yml │ │ ├── en │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── es │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── index.py │ │ ├── ru │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ └── test_code.py │ ├── 45-linting │ │ ├── Makefile │ │ ├── description.es.yml │ │ ├── en │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── es │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── index.py │ │ ├── ru │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ └── test_code.py │ ├── description.en.yml │ ├── description.es.yml │ └── description.ru.yml ├── 25-strings │ ├── 10-quotes │ │ ├── Makefile │ │ ├── description.es.yml │ │ ├── en │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── es │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── index.py │ │ ├── ru │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ └── test_code.py │ ├── 15-escape-characters │ │ ├── Makefile │ │ ├── description.es.yml │ │ ├── en │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── es │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── index.py │ │ ├── ru │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ └── test_code.py │ ├── 20-string-concatenation │ │ ├── Makefile │ │ ├── description.es.yml │ │ ├── en │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── es │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── index.py │ │ ├── ru │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ └── test_code.py │ ├── 30-encoding │ │ ├── Makefile │ │ ├── description.es.yml │ │ ├── en │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── es │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── index.py │ │ ├── ru │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ └── test_code.py │ ├── description.en.yml │ ├── description.es.yml │ └── description.ru.yml ├── 30-variables │ ├── 10-definition │ │ ├── Makefile │ │ ├── description.es.yml │ │ ├── en │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── es │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── index.py │ │ ├── ru │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ └── test_code.py │ ├── 12-change │ │ ├── Makefile │ │ ├── description.es.yml │ │ ├── en │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── es │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── index.py │ │ ├── ru │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ └── test_code.py │ ├── 13-variables-naming │ │ ├── Makefile │ │ ├── description.es.yml │ │ ├── en │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── es │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── index.py │ │ ├── ru │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ └── test_code.py │ ├── 14-errors │ │ ├── Makefile │ │ ├── description.es.yml │ │ ├── en │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── es │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── index.py │ │ ├── ru │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ └── test_code.py │ ├── 15-variables-expressions │ │ ├── Makefile │ │ ├── description.es.yml │ │ ├── en │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── es │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── index.py │ │ ├── ru │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ └── test_code.py │ ├── 18-variable-concatenation │ │ ├── Makefile │ │ ├── description.es.yml │ │ ├── en │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── es │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── index.py │ │ ├── ru │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ └── test_code.py │ ├── 19-naming-style │ │ ├── Makefile │ │ ├── description.es.yml │ │ ├── en │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── es │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── index.py │ │ ├── ru │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ └── test_code.py │ ├── 20-magic-numbers │ │ ├── Makefile │ │ ├── description.es.yml │ │ ├── en │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── es │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── index.py │ │ ├── ru │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ └── test_code.py │ ├── 23-constants │ │ ├── Makefile │ │ ├── description.es.yml │ │ ├── en │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── es │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── index.py │ │ ├── ru │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ └── test_code.py │ ├── description.en.yml │ ├── description.es.yml │ └── description.ru.yml ├── 31-advanced-strings │ ├── 25-interpolation │ │ ├── .DS_Store │ │ ├── Makefile │ │ ├── description.es.yml │ │ ├── en │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── es │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── index.py │ │ ├── ru │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ └── test_code.py │ ├── 30-symbols │ │ ├── Makefile │ │ ├── description.es.yml │ │ ├── en │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── es │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── index.py │ │ ├── ru │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ └── test_code.py │ ├── 70-slices │ │ ├── Makefile │ │ ├── description.es.yml │ │ ├── en │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── es │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── index.py │ │ ├── ru │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ └── test_code.py │ ├── 90-multiline-strings │ │ ├── .DS_Store │ │ ├── Makefile │ │ ├── description.es.yml │ │ ├── en │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── es │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── index.py │ │ ├── ru │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ └── test_code.py │ ├── description.en.yml │ ├── description.es.yml │ └── description.ru.yml ├── 33-data-types │ ├── 40-primitive-data-types │ │ ├── Makefile │ │ ├── description.es.yml │ │ ├── en │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── es │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── index.py │ │ ├── ru │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ └── test_code.py │ ├── 50-strong-typing │ │ ├── Makefile │ │ ├── description.es.yml │ │ ├── en │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── es │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── index.py │ │ ├── ru │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ └── test_code.py │ ├── 52-data-types-immutability │ │ ├── Makefile │ │ ├── description.es.yml │ │ ├── en │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── es │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── index.py │ │ ├── ru │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ └── test_code.py │ ├── 55-data-types-casting │ │ ├── Makefile │ │ ├── description.es.yml │ │ ├── en │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── es │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── index.py │ │ ├── ru │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ └── test_code.py │ ├── description.en.yml │ ├── description.es.yml │ └── description.ru.yml ├── 35-calling-functions │ ├── 100-call │ │ ├── Makefile │ │ ├── description.es.yml │ │ ├── en │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── es │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── index.py │ │ ├── ru │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ └── test_code.py │ ├── 120-function-signature │ │ ├── Makefile │ │ ├── description.es.yml │ │ ├── en │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── es │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── index.py │ │ ├── ru │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ └── test_code.py │ ├── 135-calling-functions-default-arguments │ │ ├── Makefile │ │ ├── description.es.yml │ │ ├── en │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── es │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── index.py │ │ ├── ru │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ └── test_code.py │ ├── 150-calling-funcitons-expression │ │ ├── Makefile │ │ ├── description.es.yml │ │ ├── en │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── es │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── index.py │ │ ├── ru │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ └── test_code.py │ ├── 180-variadic-parameters │ │ ├── Makefile │ │ ├── description.es.yml │ │ ├── en │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── es │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── index.py │ │ ├── ru │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ └── test_code.py │ ├── 270-deterministic │ │ ├── Makefile │ │ ├── description.es.yml │ │ ├── en │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── es │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── index.py │ │ ├── ru │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ └── test_code.py │ ├── 900-stdlib │ │ ├── Makefile │ │ ├── description.es.yml │ │ ├── en │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── es │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── index.py │ │ ├── ru │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ └── test_code.py │ ├── description.en.yml │ ├── description.es.yml │ └── description.ru.yml ├── 38-objects │ ├── 100-objects │ │ ├── Makefile │ │ ├── description.es.yml │ │ ├── en │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── es │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── index.py │ │ ├── ru │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ └── test_code.py │ ├── 200-methods-immutability │ │ ├── Makefile │ │ ├── description.es.yml │ │ ├── en │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── es │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── index.py │ │ ├── ru │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ └── test_code.py │ ├── 300-method-expressions │ │ ├── Makefile │ │ ├── description.es.yml │ │ ├── en │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── es │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── index.py │ │ ├── ru │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ └── test_code.py │ ├── 500-method-chain │ │ ├── Makefile │ │ ├── description.es.yml │ │ ├── en │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── es │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── index.py │ │ ├── ru │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ └── test_code.py │ ├── description.en.yml │ ├── description.es.yml │ └── description.ru.yml ├── 40-define-functions │ ├── 100-define-function │ │ ├── Makefile │ │ ├── description.es.yml │ │ ├── en │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── es │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── index.py │ │ ├── ru │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ └── test_code.py │ ├── 200-return │ │ ├── Makefile │ │ ├── description.es.yml │ │ ├── en │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── es │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── index.py │ │ ├── ru │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ └── test_code.py │ ├── 300-parameters │ │ ├── Makefile │ │ ├── description.es.yml │ │ ├── en │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── es │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── index.py │ │ ├── ru │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ └── test_code.py │ ├── 400-default-parameters │ │ ├── Makefile │ │ ├── description.es.yml │ │ ├── en │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── es │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── index.py │ │ ├── ru │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ └── test_code.py │ ├── 500-named-arguments │ │ ├── Makefile │ │ ├── description.es.yml │ │ ├── en │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── es │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── index.py │ │ ├── ru │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ └── test_code.py │ ├── 600-type-annotations │ │ ├── Makefile │ │ ├── description.es.yml │ │ ├── en │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── es │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── index.py │ │ ├── ru │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ └── test_code.py │ ├── description.en.yml │ ├── description.es.yml │ ├── description.ru.yml │ └── test_code.py ├── 45-logic │ ├── 10-bool-type │ │ ├── Makefile │ │ ├── description.es.yml │ │ ├── en │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── es │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── index.py │ │ ├── ru │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ └── test_code.py │ ├── 15-predicates │ │ ├── Makefile │ │ ├── description.es.yml │ │ ├── en │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── es │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── index.py │ │ ├── ru │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ └── test_code.py │ ├── 20-logic-combine-expressions │ │ ├── Makefile │ │ ├── description.es.yml │ │ ├── en │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── es │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── index.py │ │ ├── ru │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ └── test_code.py │ ├── 25-logical-operators │ │ ├── Makefile │ │ ├── assets │ │ │ └── lannisters.jpg │ │ ├── description.es.yml │ │ ├── en │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── es │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── index.py │ │ ├── ru │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ └── test_code.py │ ├── 28-logical-negation │ │ ├── Makefile │ │ ├── description.es.yml │ │ ├── en │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── es │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── index.py │ │ ├── ru │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ └── test_code.py │ ├── 90-logical-expressions │ │ ├── Makefile │ │ ├── description.es.yml │ │ ├── en │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── es │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── index.py │ │ ├── ru │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ └── test_code.py │ ├── description.en.yml │ ├── description.es.yml │ └── description.ru.yml ├── 48-conditionals │ ├── 30-if │ │ ├── Makefile │ │ ├── description.es.yml │ │ ├── en │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── es │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── index.py │ │ ├── ru │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ └── test_code.py │ ├── 40-if-else │ │ ├── Makefile │ │ ├── description.es.yml │ │ ├── en │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── es │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── index.py │ │ ├── ru │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ └── test_code.py │ ├── 50-else-if │ │ ├── Makefile │ │ ├── description.es.yml │ │ ├── en │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── es │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── index.py │ │ ├── ru │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ └── test_code.py │ ├── 60-ternary-operator │ │ ├── Makefile │ │ ├── description.es.yml │ │ ├── en │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── es │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── index.py │ │ ├── ru │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ └── test_code.py │ ├── 65-match │ │ ├── Makefile │ │ ├── description.es.yml │ │ ├── en │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── es │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── index.py │ │ ├── ru │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ └── test_code.py │ ├── description.en.yml │ ├── description.es.yml │ └── description.ru.yml ├── 50-loops │ ├── 10-while │ │ ├── Makefile │ │ ├── description.es.yml │ │ ├── en │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── es │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── index.py │ │ ├── ru │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ └── test_code.py │ ├── 20-aggregation-numbers │ │ ├── Makefile │ │ ├── description.es.yml │ │ ├── en │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── es │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── index.py │ │ ├── ru │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ └── test_code.py │ ├── 23-aggregation-strings │ │ ├── Makefile │ │ ├── description.es.yml │ │ ├── en │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── es │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── index.py │ │ ├── ru │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ └── test_code.py │ ├── 25-iteration-over-string │ │ ├── Makefile │ │ ├── description.es.yml │ │ ├── en │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── es │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── index.py │ │ ├── ru │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ └── test_code.py │ ├── 26-conditions-inside-loops │ │ ├── Makefile │ │ ├── description.es.yml │ │ ├── en │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── es │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── index.py │ │ ├── ru │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ └── test_code.py │ ├── 28-build-string │ │ ├── Makefile │ │ ├── description.es.yml │ │ ├── en │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── es │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── index.py │ │ ├── ru │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ └── test_code.py │ ├── 29-edge-cases │ │ ├── Makefile │ │ ├── description.es.yml │ │ ├── en │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── es │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── index.py │ │ ├── ru │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ └── test_code.py │ ├── 30-syntactic-sugar │ │ ├── Makefile │ │ ├── description.es.yml │ │ ├── en │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── es │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── index.py │ │ ├── ru │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ └── test_code.py │ ├── 55-return-from-loops │ │ ├── Makefile │ │ ├── description.es.yml │ │ ├── en │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── es │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── index.py │ │ ├── ru │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ └── test_code.py │ ├── 70-for │ │ ├── Makefile │ │ ├── description.es.yml │ │ ├── en │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── es │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── index.py │ │ ├── ru │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ └── test_code.py │ ├── 80-for-in-range │ │ ├── Makefile │ │ ├── en │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ ├── index.py │ │ ├── ru │ │ │ ├── EXERCISE.md │ │ │ ├── README.md │ │ │ └── data.yml │ │ └── test_code.py │ ├── description.en.yml │ ├── description.es.yml │ └── description.ru.yml └── ignored_languagetool_errors ├── pyproject.toml ├── spec.yml ├── src ├── hexlet │ ├── __init__.py │ └── test.py └── setup │ └── __init__.py └── uv.lock /.github/workflows/Docker.yml: -------------------------------------------------------------------------------- 1 | name: Docker 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | pull_request: 8 | branches: 9 | - main 10 | 11 | jobs: 12 | main: 13 | runs-on: ubuntu-latest 14 | 15 | steps: 16 | - uses: hexlet-basics/exercises-action@release 17 | with: 18 | DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} 19 | DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} 20 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.ru 2 | __pycache__ 3 | .mypy_cache 4 | .DS_Store 5 | .ropeproject 6 | text_length.txt 7 | -------------------------------------------------------------------------------- /.markdownlint.json: -------------------------------------------------------------------------------- 1 | { 2 | "MD013": false, 3 | "MD033": false, 4 | "MD041": false, 5 | "MD040": false 6 | } 7 | -------------------------------------------------------------------------------- /.yamllint: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | extends: default 4 | 5 | rules: 6 | line-length: disable 7 | empty-lines: disable 8 | trailing-spaces: disable 9 | -------------------------------------------------------------------------------- /bin/test.sh: -------------------------------------------------------------------------------- 1 | pytest -p setup --capture=no --color=yes -x --tb=short -q 2 | -------------------------------------------------------------------------------- /docker-compose.override.yml: -------------------------------------------------------------------------------- 1 | --- 2 | services: 3 | exercises: 4 | volumes: 5 | - .:/exercises-python 6 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | --- 2 | services: 3 | exercises: 4 | build: . 5 | image: hexletbasics/exercises-python:cached 6 | command: make check 7 | -------------------------------------------------------------------------------- /modules/10-basics/10-hello-world/Makefile: -------------------------------------------------------------------------------- 1 | test: 2 | @ test.sh 3 | -------------------------------------------------------------------------------- /modules/10-basics/10-hello-world/en/EXERCISE.md: -------------------------------------------------------------------------------- 1 | Copy the exact code from the instructions into the editor and run it by clicking “Run”. 2 | 3 | ```python 4 | print('Hello, World!') 5 | ``` 6 | 7 | Note: if you write `heLLo, woRld!` instead of `Hello, World!`, it will be considered different text, because upper and lower case letters are different characters and different _registers_. In programming, the register almost always matters, so get used to always paying attention to it! 8 | -------------------------------------------------------------------------------- /modules/10-basics/10-hello-world/en/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Hello, world! 3 | -------------------------------------------------------------------------------- /modules/10-basics/10-hello-world/es/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: ¡Hola, Mundo! 3 | tips: 4 | - > 5 | [Un poco sobre 'Hello, 6 | World!'](https://codica.la/blog/mi-gente-me-entiende-la-historia-de-la-frase-hello-world-y-sus-analogos) 7 | -------------------------------------------------------------------------------- /modules/10-basics/10-hello-world/index.py: -------------------------------------------------------------------------------- 1 | print("Hello, World!") 2 | -------------------------------------------------------------------------------- /modules/10-basics/10-hello-world/ru/EXERCISE.md: -------------------------------------------------------------------------------- 1 | Наберите в редакторе код из задания символ в символ и нажмите «Проверить». 2 | 3 | ```python 4 | print('Hello, World!') 5 | ``` 6 | 7 | Обратите внимание: если вы напишете `heLLo, woRld!` вместо `Hello, World!`, то это будет считаться другим текстом, потому что заглавные и строчные буквы — это разные символы, отличающиеся _регистром_. В программировании регистр практически всегда имеет значение. 8 | -------------------------------------------------------------------------------- /modules/10-basics/10-hello-world/ru/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Привет, Мир! 3 | tips: 4 | - > 5 | [Немного о 'Hello, 6 | World!'](https://ru.hexlet.io/blog/posts/moy-chelovek-menya-ponimaet-istoriya-frazy-hello-world-i-ee-analogov?utm_source=code-basics&utm_medium=referral&utm_campaign=blog&utm_content=lesson) 7 | -------------------------------------------------------------------------------- /modules/10-basics/10-hello-world/test_code.py: -------------------------------------------------------------------------------- 1 | from hexlet.test import expect_output 2 | 3 | 4 | def test(capsys): 5 | expected = "Hello, World!" 6 | expect_output(capsys, expected) 7 | -------------------------------------------------------------------------------- /modules/10-basics/20-comments/Makefile: -------------------------------------------------------------------------------- 1 | test: 2 | @ test.sh 3 | -------------------------------------------------------------------------------- /modules/10-basics/20-comments/en/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Create a one-line comment with the text: `You know nothing, Jon Snow!` 3 | -------------------------------------------------------------------------------- /modules/10-basics/20-comments/en/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Comments 3 | tips: [] 4 | definitions: 5 | - name: Comments 6 | description: > 7 | text in the program code that does not affect the functionality and is 8 | added by programmers for themselves and their colleagues. 9 | -------------------------------------------------------------------------------- /modules/10-basics/20-comments/es/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Crea un comentario de una línea con el texto: `You know nothing, Jon Snow!` 3 | -------------------------------------------------------------------------------- /modules/10-basics/20-comments/es/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Comentarios 3 | tips: 4 | - > 5 | [Más información sobre 6 | comentarios](https://www.w3schools.com/python/python_comments.asp) 7 | definitions: 8 | - name: Comentario 9 | description: > 10 | se trata de un texto en el código de un programa que no afecta su 11 | funcionalidad y lo agregan los programadores para su propio uso y/o el de 12 | sus colegas. 13 | -------------------------------------------------------------------------------- /modules/10-basics/20-comments/index.py: -------------------------------------------------------------------------------- 1 | # You know nothing, Jon Snow! 2 | -------------------------------------------------------------------------------- /modules/10-basics/20-comments/ru/EXERCISE.md: -------------------------------------------------------------------------------- 1 | Создайте комментарий с текстом: `You know nothing, Jon Snow!` 2 | -------------------------------------------------------------------------------- /modules/10-basics/20-comments/ru/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Комментарии 3 | tips: 4 | - > 5 | [Подробнее о 6 | комментариях](https://www.w3schools.com/python/python_comments.asp) 7 | definitions: 8 | - name: Комментарий 9 | description: > 10 | текст в коде программы, который не влияет на функциональность и 11 | добавляется программистами для себя и своих коллег. 12 | -------------------------------------------------------------------------------- /modules/10-basics/20-comments/test_code.py: -------------------------------------------------------------------------------- 1 | def test(): 2 | with open("index.py") as file: 3 | comment = file.read().rstrip() 4 | assert comment == "# You know nothing, Jon Snow!" 5 | print(comment) 6 | -------------------------------------------------------------------------------- /modules/10-basics/30-instructions/Makefile: -------------------------------------------------------------------------------- 1 | test: 2 | @ test.sh 3 | -------------------------------------------------------------------------------- /modules/10-basics/30-instructions/en/EXERCISE.md: -------------------------------------------------------------------------------- 1 | Display three names, one after another: _Robert_, _Stannis_, _Renly_. The result should be that the following is shown on the screen: 2 | 3 |
 4 | Robert
 5 | Stannis
 6 | Renly
 7 | 
8 | 9 | For each name, use Python's own `print()` call. 10 | -------------------------------------------------------------------------------- /modules/10-basics/30-instructions/en/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Statements 3 | tips: 4 | - > 5 | [A little bit about 6 | interpreters](https://en.wikipedia.org/wiki/Interpreter_(computing)) 7 | definitions: 8 | - name: Interpreter 9 | description: | 10 | a program that runs code in Python. 11 | - name: Statement 12 | description: >- 13 | a command for the computer written in a programming language. Python code 14 | is a set of instructions, most often separated by a line break. 15 | -------------------------------------------------------------------------------- /modules/10-basics/30-instructions/es/EXERCISE.md: -------------------------------------------------------------------------------- 1 | Imprime en la pantalla uno tras otro tres nombres: *Robert*, *Stannis*, *Renly*. Como resultado, se debe mostrar en la pantalla: 2 | 3 |
 4 | Robert
 5 | Stannis
 6 | Renly
 7 | 
8 | 9 | Por cada nombre o designación, usa nuevamente la orden de `print()`. 10 | -------------------------------------------------------------------------------- /modules/10-basics/30-instructions/index.py: -------------------------------------------------------------------------------- 1 | print("Robert") 2 | print("Stannis") 3 | print("Renly") 4 | -------------------------------------------------------------------------------- /modules/10-basics/30-instructions/ru/EXERCISE.md: -------------------------------------------------------------------------------- 1 | Выведите на экран друг за другом три имени: *Robert*, *Stannis*, *Renly*. В результате на экране должно отобразиться: 2 | 3 |
 4 | Robert
 5 | Stannis
 6 | Renly
 7 | 
8 | 9 | Для каждого имени используйте свой собственный вызов `print()`. 10 | -------------------------------------------------------------------------------- /modules/10-basics/30-instructions/test_code.py: -------------------------------------------------------------------------------- 1 | from hexlet.test import expect_output 2 | 3 | 4 | def test(capsys): 5 | expected = "Robert\nStannis\nRenly" 6 | expect_output(capsys, expected) 7 | -------------------------------------------------------------------------------- /modules/10-basics/40-testing/Makefile: -------------------------------------------------------------------------------- 1 | test: 2 | @ test.sh 3 | -------------------------------------------------------------------------------- /modules/10-basics/40-testing/en/EXERCISE.md: -------------------------------------------------------------------------------- 1 | Display `9780262531962`. 2 | -------------------------------------------------------------------------------- /modules/10-basics/40-testing/en/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: How we check your solutions 3 | definitions: 4 | - name: Tests 5 | description: >- 6 | a special code that checks programs for correctness by comparing the 7 | result obtained during the execution of the program with the expected 8 | result. 9 | tips: 10 | - | 11 | [TDD](https://en.wikipedia.org/wiki/Test-driven_development) 12 | -------------------------------------------------------------------------------- /modules/10-basics/40-testing/es/EXERCISE.md: -------------------------------------------------------------------------------- 1 | Muestra en la pantalla `9780262531962`. 2 | -------------------------------------------------------------------------------- /modules/10-basics/40-testing/index.py: -------------------------------------------------------------------------------- 1 | print("9780262531962") 2 | -------------------------------------------------------------------------------- /modules/10-basics/40-testing/ru/EXERCISE.md: -------------------------------------------------------------------------------- 1 | Выведите на экран `9780262531962` используя `print()`. 2 | -------------------------------------------------------------------------------- /modules/10-basics/40-testing/ru/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Как мы проверяем ваши решения 3 | definitions: 4 | - name: Тесты 5 | description: >- 6 | специальный код, проверяющий программы на корректность путём сравнения 7 | полученного при выполнении программы результата с ожидаемым. 8 | tips: 9 | - | 10 | [TDD](https://ru.wikipedia.org/wiki/Разработка_через_тестирование) 11 | - | 12 | [Сообщество Хекслета в Telegram](https://t.me/hexletcommunity) 13 | -------------------------------------------------------------------------------- /modules/10-basics/40-testing/test_code.py: -------------------------------------------------------------------------------- 1 | from hexlet.test import expect_output 2 | 3 | 4 | def test(capsys): 5 | expected = "9780262531962" 6 | expect_output(capsys, expected) 7 | -------------------------------------------------------------------------------- /modules/10-basics/50-syntax-errors/Makefile: -------------------------------------------------------------------------------- 1 | test: 2 | @ test.sh 3 | -------------------------------------------------------------------------------- /modules/10-basics/50-syntax-errors/en/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | This assignment is not directly related to the lesson. But it will be useful to practice with the output on the screen. 3 | 4 | Display: 5 | 6 |
What Is Dead May Never Die
7 | -------------------------------------------------------------------------------- /modules/10-basics/50-syntax-errors/en/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Syntax errors 3 | tips: [] 4 | definitions: 5 | - name: Syntax errors 6 | description: violation of the grammatical rules of the programming language. 7 | - name: SyntaxError (parsing error) 8 | description: >- 9 | the type of errors in Python that occur when there are syntax errors in 10 | the code. 11 | -------------------------------------------------------------------------------- /modules/10-basics/50-syntax-errors/es/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Esta tarea no está directamente relacionada con la lección. Pero será útil practicar la impresión en la pantalla. 3 | 4 | Imprime en la pantalla: 5 | 6 |
What Is Dead May Never Die
7 | -------------------------------------------------------------------------------- /modules/10-basics/50-syntax-errors/index.py: -------------------------------------------------------------------------------- 1 | print("What Is Dead May Never Die") 2 | -------------------------------------------------------------------------------- /modules/10-basics/50-syntax-errors/ru/EXERCISE.md: -------------------------------------------------------------------------------- 1 | Это задание не связано с уроком напрямую. Но будет полезным потренироваться с выводом на экран. 2 | 3 | Выведите на экран: 4 | 5 |
What Is Dead May Never Die
6 | -------------------------------------------------------------------------------- /modules/10-basics/50-syntax-errors/ru/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Синтаксические ошибки 3 | tips: 4 | - > 5 | [Виды ошибок в 6 | Python](https://docs.python.org/3/library/exceptions.html#exception-hierarchy) 7 | definitions: 8 | - name: Синтаксическая ошибка 9 | description: нарушение грамматических правил языка программирования. 10 | - name: SyntaxError (ошибка парсинга) 11 | description: тип ошибок в Python, возникающих при наличии синтаксических ошибок в коде. 12 | -------------------------------------------------------------------------------- /modules/10-basics/50-syntax-errors/test_code.py: -------------------------------------------------------------------------------- 1 | from hexlet.test import expect_output 2 | 3 | 4 | def test(capsys): 5 | expected = "What Is Dead May Never Die" 6 | expect_output(capsys, expected) 7 | -------------------------------------------------------------------------------- /modules/20-arithmetics/20-basic/Makefile: -------------------------------------------------------------------------------- 1 | test: 2 | @ test.sh 3 | -------------------------------------------------------------------------------- /modules/20-arithmetics/20-basic/en/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Print the result of dividing `81` by `9`. 3 | -------------------------------------------------------------------------------- /modules/20-arithmetics/20-basic/en/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Arithmetic operations 3 | tips: 4 | - > 5 | Always indent arithmetic operators with spaces between the numbers 6 | (operands) – it's good form when programming. Therefore, in our examples, we 7 | have `print(3 + 4)` rather than `print(3+4)`. 8 | - Division by zero generates an error. 9 | -------------------------------------------------------------------------------- /modules/20-arithmetics/20-basic/es/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Muestra en pantalla el resultado de dividir el número `81` entre `9`. 3 | -------------------------------------------------------------------------------- /modules/20-arithmetics/20-basic/index.py: -------------------------------------------------------------------------------- 1 | print(81 / 9) 2 | -------------------------------------------------------------------------------- /modules/20-arithmetics/20-basic/ru/EXERCISE.md: -------------------------------------------------------------------------------- 1 | Выведите на экран результат деления числа `81` на `9`. 2 | -------------------------------------------------------------------------------- /modules/20-arithmetics/20-basic/test_code.py: -------------------------------------------------------------------------------- 1 | from hexlet.test import expect_output 2 | 3 | 4 | def test(capsys): 5 | expected = "9.0" 6 | expect_output(capsys, expected) 7 | -------------------------------------------------------------------------------- /modules/20-arithmetics/25-operator/Makefile: -------------------------------------------------------------------------------- 1 | test: 2 | @ test.sh 3 | -------------------------------------------------------------------------------- /modules/20-arithmetics/25-operator/en/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Write a program that calculates the difference between the numbers `6` and `-81` and displays the answer on the screen. 3 | -------------------------------------------------------------------------------- /modules/20-arithmetics/25-operator/es/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Escribe un programa que calcule la diferencia entre los números `6` y `-81` y muestre la respuesta en pantalla. 3 | -------------------------------------------------------------------------------- /modules/20-arithmetics/25-operator/index.py: -------------------------------------------------------------------------------- 1 | print(6 - -81) 2 | -------------------------------------------------------------------------------- /modules/20-arithmetics/25-operator/ru/EXERCISE.md: -------------------------------------------------------------------------------- 1 | Напишите программу, которая посчитает разность между числами `6` и `-81` и выведет ответ на экран. 2 | -------------------------------------------------------------------------------- /modules/20-arithmetics/25-operator/test_code.py: -------------------------------------------------------------------------------- 1 | from hexlet.test import expect_output 2 | 3 | 4 | def test(capsys): 5 | expected = "87" 6 | expect_output(capsys, expected) 7 | -------------------------------------------------------------------------------- /modules/20-arithmetics/27-commutativity/Makefile: -------------------------------------------------------------------------------- 1 | test: 2 | @ test.sh 3 | -------------------------------------------------------------------------------- /modules/20-arithmetics/27-commutativity/en/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Write a program that calculates and displays sequentially (one value per line) the values of the following mathematical expressions: "3 to the power of 5" and "-8 divided by -4". 3 | -------------------------------------------------------------------------------- /modules/20-arithmetics/27-commutativity/en/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Commutative operation 3 | tips: [] 4 | definitions: 5 | - name: Commutativity 6 | description: > 7 | the property of an operation where changing the order of operands does not 8 | affect the result. For example, addition is a commutative operation: 9 | changing the order of the numbers we are adding doesn't change the result. 10 | -------------------------------------------------------------------------------- /modules/20-arithmetics/27-commutativity/es/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Escriba un programa que calcule y muestre en pantalla, de forma secuencial (un valor por línea), los resultados de las siguientes expresiones matemáticas: "3 elevado a la 5" y "-8 dividido por -4". 3 | -------------------------------------------------------------------------------- /modules/20-arithmetics/27-commutativity/es/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Operación conmutativa 3 | tips: 4 | - > 5 | [Más información sobre la 6 | conmutatividad](https://es.wikipedia.org/wiki/Conmutatividad) 7 | definitions: 8 | - name: Conmutatividad 9 | description: > 10 | propiedad de una operación en la que el cambio de orden de los operandos 11 | no afecta al resultado. Por ejemplo, la suma es una operación conmutativa: 12 | la suma no cambia al cambiar el orden de los sumandos. 13 | -------------------------------------------------------------------------------- /modules/20-arithmetics/27-commutativity/index.py: -------------------------------------------------------------------------------- 1 | print(3**5) 2 | print(-8 / -4) 3 | -------------------------------------------------------------------------------- /modules/20-arithmetics/27-commutativity/ru/EXERCISE.md: -------------------------------------------------------------------------------- 1 | Напишите программу, которая считает и выводит на экран последовательно (по одному значению в каждой строчке) значения следующих математических выражений: «3 в степени 5» и «-8 разделить на -4». 2 | -------------------------------------------------------------------------------- /modules/20-arithmetics/27-commutativity/ru/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Коммутативная операция 3 | tips: 4 | - > 5 | [Подробнее про 6 | коммутативность](https://ru.wikipedia.org/wiki/Коммутативность) 7 | definitions: 8 | - name: Коммутативность 9 | description: > 10 | свойство операции, когда изменение порядка операндов не влияет на 11 | результат. Например, сложение — коммутативная операция: от перемены мест 12 | слагаемых сумма не меняется. 13 | -------------------------------------------------------------------------------- /modules/20-arithmetics/27-commutativity/test_code.py: -------------------------------------------------------------------------------- 1 | from hexlet.test import expect_output 2 | 3 | 4 | def test(capsys): 5 | expected = "243\n2.0" 6 | expect_output(capsys, expected) 7 | -------------------------------------------------------------------------------- /modules/20-arithmetics/30-composition/Makefile: -------------------------------------------------------------------------------- 1 | test: 2 | @ test.sh 3 | -------------------------------------------------------------------------------- /modules/20-arithmetics/30-composition/en/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Write a program that calculates and prints the value of this expression: 3 | 4 | ``` 5 | 8 / 2 + 5 - -3 / 2 6 | ``` 7 | 8 | Don't calculate anything manually, your program should do all the calculations on its own. 9 | -------------------------------------------------------------------------------- /modules/20-arithmetics/30-composition/en/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Composition of operations 3 | tips: [] 4 | -------------------------------------------------------------------------------- /modules/20-arithmetics/30-composition/es/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Implementa un programa que calcule y muestre en pantalla el valor de la expresión: 3 | 4 | ``` 5 | 8 / 2 + 5 - -3 / 2 6 | ``` 7 | 8 | No calcules nada por tu cuenta, tu programa debe realizar todos los cálculos por sí mismo. 9 | -------------------------------------------------------------------------------- /modules/20-arithmetics/30-composition/es/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Composición de operaciones 3 | tips: [] 4 | definitions: 5 | - name: Composición 6 | description: > 7 | método de combinar varias operaciones simples en una sola operación 8 | compleja. 9 | -------------------------------------------------------------------------------- /modules/20-arithmetics/30-composition/index.py: -------------------------------------------------------------------------------- 1 | print(((8 / 2) + 5) - (-3 / 2)) 2 | -------------------------------------------------------------------------------- /modules/20-arithmetics/30-composition/ru/EXERCISE.md: -------------------------------------------------------------------------------- 1 | Реализуйте программу, которая вычисляет и выводит на экран значение выражения: 2 | 3 | ``` 4 | 8 / 2 + 5 - -3 / 2 5 | ``` 6 | 7 | Не вычисляйте ничего самостоятельно, ваша программа должна производить все вычисления сама. 8 | -------------------------------------------------------------------------------- /modules/20-arithmetics/30-composition/ru/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Композиция операций 3 | tips: [] 4 | definitions: 5 | - name: Композиция 6 | description: | 7 | метод объединения нескольких простых операций в одну сложную. 8 | -------------------------------------------------------------------------------- /modules/20-arithmetics/30-composition/test_code.py: -------------------------------------------------------------------------------- 1 | from hexlet.test import expect_output 2 | 3 | 4 | def test(capsys): 5 | expected = "10.5" 6 | expect_output(capsys, expected) 7 | -------------------------------------------------------------------------------- /modules/20-arithmetics/40-priority/Makefile: -------------------------------------------------------------------------------- 1 | test: 2 | @ test.sh 3 | -------------------------------------------------------------------------------- /modules/20-arithmetics/40-priority/en/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | The calculation is given `70 * 3 + 4 / 8 + 2`. 3 | 4 | Place parentheses so that both additions (`3 + 4`) и (`8 + 2`) were calculated in the first place. Print the result on the screen. 5 | -------------------------------------------------------------------------------- /modules/20-arithmetics/40-priority/en/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Priority 3 | tips: [] 4 | -------------------------------------------------------------------------------- /modules/20-arithmetics/40-priority/es/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Dada la expresión `70 * 3 + 4 / 8 + 2`. 3 | 4 | Coloca paréntesis de manera que ambas sumas (`3 + 4`) y (`8 + 2`) se calculen primero. Imprime el resultado en pantalla. 5 | -------------------------------------------------------------------------------- /modules/20-arithmetics/40-priority/es/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Prioridad 3 | tips: [] 4 | definitions: 5 | - name: Expresión 6 | description: > 7 | una secuencia de acciones sobre datos que conduce a algún resultado que se 8 | puede utilizar. 9 | -------------------------------------------------------------------------------- /modules/20-arithmetics/40-priority/index.py: -------------------------------------------------------------------------------- 1 | print(70 * (3 + 4) / (8 + 2)) 2 | -------------------------------------------------------------------------------- /modules/20-arithmetics/40-priority/ru/EXERCISE.md: -------------------------------------------------------------------------------- 1 | Дано вычисление `70 * 3 + 4 / 8 + 2`. 2 | 3 | Расставьте скобки так, чтобы оба сложения (`3 + 4`) и (`8 + 2`) высчитывались в первую очередь. Выведите на экран результат. 4 | -------------------------------------------------------------------------------- /modules/20-arithmetics/40-priority/ru/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Приоритет 3 | tips: [] 4 | definitions: 5 | - name: Выражение 6 | description: > 7 | последовательность действий над данными, приводящая к каком-то результату, 8 | который можно использовать. 9 | -------------------------------------------------------------------------------- /modules/20-arithmetics/40-priority/test_code.py: -------------------------------------------------------------------------------- 1 | from hexlet.test import expect_output 2 | 3 | 4 | def test(capsys): 5 | expected = "49.0" 6 | expect_output(capsys, expected) 7 | -------------------------------------------------------------------------------- /modules/20-arithmetics/43-float/Makefile: -------------------------------------------------------------------------------- 1 | test: 2 | @ test.sh 3 | 4 | -------------------------------------------------------------------------------- /modules/20-arithmetics/43-float/en/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Calculate and display the product of two numbers: *0.39* and *0.22* 3 | -------------------------------------------------------------------------------- /modules/20-arithmetics/43-float/en/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Floating point numbers 3 | tips: 4 | - > 5 | [What you need to know about floating point 6 | arithmetic](https://www.validlab.com/goldberg/paper.pdf) 7 | -------------------------------------------------------------------------------- /modules/20-arithmetics/43-float/es/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Calcula y muestra en pantalla el producto (multiplicación) de dos números: *0.39* y *0.22* 3 | -------------------------------------------------------------------------------- /modules/20-arithmetics/43-float/es/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Números de punto flotante 3 | tips: 4 | - > 5 | [Qué debes saber sobre los números o constantes de punto 6 | flotante](https://academia-lab.com/enciclopedia/aritmetica-de-punto-flotante/) 7 | definitions: 8 | - name: Número racional 9 | description: | 10 | número que se puede representar como una fracción común. 11 | -------------------------------------------------------------------------------- /modules/20-arithmetics/43-float/index.py: -------------------------------------------------------------------------------- 1 | print(0.39 * 0.22) 2 | -------------------------------------------------------------------------------- /modules/20-arithmetics/43-float/ru/EXERCISE.md: -------------------------------------------------------------------------------- 1 | Вычислите и выведите на экран произведение двух чисел: _0.39_ и _0.22_ 2 | -------------------------------------------------------------------------------- /modules/20-arithmetics/43-float/ru/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Числа с плавающей точкой 3 | tips: 4 | - > 5 | [Что нужно знать про арифметику с плавающей 6 | запятой](https://habr.com/ru/articles/112953/) 7 | definitions: 8 | - name: Рациональное число 9 | description: | 10 | число, которое можно представить в виде обыкновенной дроби. 11 | -------------------------------------------------------------------------------- /modules/20-arithmetics/43-float/test_code.py: -------------------------------------------------------------------------------- 1 | from hexlet.test import expect_output 2 | 3 | 4 | def test(capsys): 5 | expected = "0.0858" 6 | expect_output(capsys, expected) 7 | -------------------------------------------------------------------------------- /modules/20-arithmetics/45-linting/Makefile: -------------------------------------------------------------------------------- 1 | test: 2 | @ test.sh 3 | -------------------------------------------------------------------------------- /modules/20-arithmetics/45-linting/en/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Print the result of the following calculation: "the difference between five squared and the product of three and seven". Write the code so that each operator is separated from the operands by spaces. 3 | -------------------------------------------------------------------------------- /modules/20-arithmetics/45-linting/en/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Linter 3 | tips: [] 4 | -------------------------------------------------------------------------------- /modules/20-arithmetics/45-linting/es/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Imprime en pantalla el resultado de la siguiente operación: "la diferencia entre cinco al cuadrado y el producto de tres por siete". Escribe el código de manera que cada operador esté separado de los operandos por espacios. 3 | -------------------------------------------------------------------------------- /modules/20-arithmetics/45-linting/es/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Linter 3 | tips: 4 | - | 5 | [PEP8](https://peps.python.org/pep-0008/) 6 | - | 7 | [flake8](https://flake8.pycqa.org/en/latest/) 8 | -------------------------------------------------------------------------------- /modules/20-arithmetics/45-linting/index.py: -------------------------------------------------------------------------------- 1 | print((5**2) - (3 * 7)) 2 | -------------------------------------------------------------------------------- /modules/20-arithmetics/45-linting/ru/EXERCISE.md: -------------------------------------------------------------------------------- 1 | Выведите на экран результат следующего вычисления: «разница между пятью в квадрате и произведением трёх и семи». Напишите код так, чтобы каждый оператор отделялся от операндов пробелами. 2 | -------------------------------------------------------------------------------- /modules/20-arithmetics/45-linting/ru/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Линтер 3 | tips: 4 | - | 5 | [PEP8](https://peps.python.org/pep-0008/) 6 | - | 7 | [flake8](https://flake8.pycqa.org/en/latest/) 8 | -------------------------------------------------------------------------------- /modules/20-arithmetics/45-linting/test_code.py: -------------------------------------------------------------------------------- 1 | from hexlet.test import expect_output 2 | 3 | 4 | def test(capsys): 5 | expected = "4" 6 | expect_output(capsys, expected) 7 | -------------------------------------------------------------------------------- /modules/25-strings/10-quotes/Makefile: -------------------------------------------------------------------------------- 1 | test: 2 | @ test.sh 3 | -------------------------------------------------------------------------------- /modules/25-strings/10-quotes/en/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Write a program that prints: 3 | 4 | ``` 5 | "Khal Drogo's favorite word is "athjahakar"" 6 | ``` 7 | 8 | The program should display this exact phrase on the screen. Note the quotes at the beginning and the end of the phrase: 9 | 10 |
11 | "Khal Drogo's favorite word is "athjahakar""
12 | 
13 | -------------------------------------------------------------------------------- /modules/25-strings/10-quotes/en/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Quotes 3 | tips: [] 4 | -------------------------------------------------------------------------------- /modules/25-strings/10-quotes/es/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Escribe un programa que imprima en la pantalla: 3 | 4 | ``` 5 | "Khal Drogo's favorite word is "athjahakar"" 6 | ``` 7 | 8 | El programa debe imprimir exactamente esa frase. Presta atención a las comillas al principio y al final de la frase: 9 | 10 |
11 | "Khal Drogo's favorite word is "athjahakar""
12 | 
13 | -------------------------------------------------------------------------------- /modules/25-strings/10-quotes/es/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Comillas 3 | tips: 4 | - > 5 | [f-strings](https://docs.python.org/3/tutorial/inputoutput.html#fancier-output-formatting) 6 | -------------------------------------------------------------------------------- /modules/25-strings/10-quotes/index.py: -------------------------------------------------------------------------------- 1 | print('"Khal Drogo\'s favorite word is "athjahakar""') 2 | -------------------------------------------------------------------------------- /modules/25-strings/10-quotes/ru/EXERCISE.md: -------------------------------------------------------------------------------- 1 | Напишите программу, которая выведет на экран: 2 | 3 | ``` 4 | "Khal Drogo's favorite word is "athjahakar"" 5 | ``` 6 | 7 | Программа должна вывести на экран эту фразу в точности. Обратите внимание на кавычки в начале и в конце фразы: 8 | 9 |
10 | "Khal Drogo's favorite word is "athjahakar""
11 | 
12 | -------------------------------------------------------------------------------- /modules/25-strings/10-quotes/ru/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Кавычки 3 | tips: 4 | - > 5 | [f-строки](https://docs.python.org/3/tutorial/inputoutput.html#fancier-output-formatting) 6 | -------------------------------------------------------------------------------- /modules/25-strings/10-quotes/test_code.py: -------------------------------------------------------------------------------- 1 | from hexlet.test import expect_output 2 | 3 | 4 | def test(capsys): 5 | expected = '"Khal Drogo\'s favorite word is "athjahakar""' 6 | expect_output(capsys, expected) 7 | -------------------------------------------------------------------------------- /modules/25-strings/15-escape-characters/Makefile: -------------------------------------------------------------------------------- 1 | test: 2 | @ test.sh 3 | -------------------------------------------------------------------------------- /modules/25-strings/15-escape-characters/en/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Write a program that displays on this the screen: 3 | 4 | - Did Joffrey agree? 5 | - He did. He also said "I love using \n". 6 | 7 | This program should have only one `print()`, but the result on the screen should look exactly like the one shown above. 8 | -------------------------------------------------------------------------------- /modules/25-strings/15-escape-characters/en/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Escape sequences 3 | definitions: 4 | - name: Escape sequence 5 | description: >- 6 | a special combination of characters in text. For example, \n — is a line 7 | feed. 8 | tips: 9 | - '[Line feed history](https://en.wikipedia.org/wiki/Newline)' 10 | -------------------------------------------------------------------------------- /modules/25-strings/15-escape-characters/es/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Escribe un programa que muestre en pantalla: 3 | 4 | - Did Joffrey agree? 5 | - He did. He also said "I love using \n". 6 | 7 | El programa debe utilizar solo una llamada a `print()`, pero el resultado en pantalla debe ser exactamente como se muestra arriba. 8 | -------------------------------------------------------------------------------- /modules/25-strings/15-escape-characters/es/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Secuencias de escape 3 | definitions: 4 | - name: Secuencia de escape 5 | description: >- 6 | una combinación especial de caracteres en un texto. Por ejemplo, \n es un 7 | salto de línea. 8 | tips: 9 | - >- 10 | [Historia del salto de 11 | línea](https://es.wikipedia.org/wiki/Salto_de_l%C3%ADnea#Historia) 12 | -------------------------------------------------------------------------------- /modules/25-strings/15-escape-characters/index.py: -------------------------------------------------------------------------------- 1 | print('- Did Joffrey agree?\n- He did. He also said "I love using \\n".') 2 | -------------------------------------------------------------------------------- /modules/25-strings/15-escape-characters/ru/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Напишите программу, которая выводит на экран: 3 | 4 | - Did Joffrey agree? 5 | - He did. He also said "I love using \n". 6 | 7 | При этом программа использует только один `print()`, но результат на экране должен выглядеть в точности, как показано выше. 8 | -------------------------------------------------------------------------------- /modules/25-strings/15-escape-characters/ru/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Экранированные последовательности 3 | definitions: 4 | - name: Экранированная последовательность 5 | description: >- 6 | специальная комбинация символов в тексте. Например, \n — это перевод 7 | строки. 8 | tips: 9 | - >- 10 | [История перевода 11 | строки](https://ru.wikipedia.org/wiki/Перевод_строки#История) 12 | -------------------------------------------------------------------------------- /modules/25-strings/15-escape-characters/test_code.py: -------------------------------------------------------------------------------- 1 | from hexlet.test import expect_output 2 | 3 | 4 | def test(capsys): 5 | expected = '- Did Joffrey agree?\n- He did. He also said "I love using \\n".' # noqa: E501 6 | expect_output(capsys, expected) 7 | -------------------------------------------------------------------------------- /modules/25-strings/20-string-concatenation/Makefile: -------------------------------------------------------------------------------- 1 | test: 2 | @ test.sh 3 | -------------------------------------------------------------------------------- /modules/25-strings/20-string-concatenation/en/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Display 3 | 4 | ``` 5 | Winter came for the House of Frey. 6 | ``` 7 | 8 | using concatenation. 9 | -------------------------------------------------------------------------------- /modules/25-strings/20-string-concatenation/en/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Concatenation 3 | definitions: 4 | - name: Concatenation 5 | description: > 6 | the operation of joining two strings. For example, `print("King's " + ' 7 | Landing')` 8 | -------------------------------------------------------------------------------- /modules/25-strings/20-string-concatenation/es/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Imprime en pantalla 3 | 4 | ```text 5 | Winter came for the House of Frey. 6 | ``` 7 | 8 | utilizando la concatenación de palabras. 9 | -------------------------------------------------------------------------------- /modules/25-strings/20-string-concatenation/es/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Concatenación 3 | tips: 4 | - > 5 | Si hay una línea `# BEGIN` y `# END` en el editor, el código debe escribirse 6 | entre esas líneas. 7 | definitions: 8 | - name: Concatenación 9 | description: > 10 | operación que une dos cadenas de texto. Por ejemplo, `print("King's " + ' 11 | Landing')` 12 | -------------------------------------------------------------------------------- /modules/25-strings/20-string-concatenation/index.py: -------------------------------------------------------------------------------- 1 | print("Winter " + "came " + "for " + "the " + "House " + "of " + "Frey.") 2 | -------------------------------------------------------------------------------- /modules/25-strings/20-string-concatenation/ru/EXERCISE.md: -------------------------------------------------------------------------------- 1 | Выведите на экран фразу используя конкатенацию слов. 2 | 3 | ```text 4 | Winter came for the House of Frey. 5 | ``` 6 | 7 | -------------------------------------------------------------------------------- /modules/25-strings/20-string-concatenation/ru/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Конкатенация 3 | tips: 4 | - > 5 | Если в редакторе есть запись `# BEGIN` и `# END`, то код нужно писать между 6 | этими строчками. 7 | definitions: 8 | - name: Конкатенация 9 | description: | 10 | операция соединения двух строк. Например, `print("King's " + ' Landing')` 11 | -------------------------------------------------------------------------------- /modules/25-strings/20-string-concatenation/test_code.py: -------------------------------------------------------------------------------- 1 | from hexlet.test import expect_output 2 | 3 | 4 | def test(capsys): 5 | expected = "Winter came for the House of Frey." 6 | expect_output(capsys, expected) 7 | -------------------------------------------------------------------------------- /modules/25-strings/30-encoding/Makefile: -------------------------------------------------------------------------------- 1 | test: 2 | @ test.sh 3 | -------------------------------------------------------------------------------- /modules/25-strings/30-encoding/en/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Encoding 3 | tips: 4 | - | 5 | [What are encodings?](https://guides.hexlet.io/en/encoding/) 6 | definitions: 7 | - name: Encoding 8 | description: a set of characters encoded with numbers to represent text electronically. 9 | -------------------------------------------------------------------------------- /modules/25-strings/30-encoding/es/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Codificación 3 | tips: 4 | - | 5 | [¿Qué son las codificaciones?](https://codica.la/guides/encoding) 6 | definitions: 7 | - name: Codificación 8 | description: >- 9 | conjunto de caracteres codificados con números para representar texto en 10 | formato electrónico. 11 | -------------------------------------------------------------------------------- /modules/25-strings/30-encoding/index.py: -------------------------------------------------------------------------------- 1 | print(chr(126)) 2 | print(chr(94)) 3 | print(chr(37)) 4 | -------------------------------------------------------------------------------- /modules/25-strings/30-encoding/ru/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Кодировка 3 | tips: 4 | - | 5 | [Что такое кодировки?](https://guides.hexlet.io/ru/encoding/) 6 | definitions: 7 | - name: Кодировка 8 | description: >- 9 | набор символов, закодированных с помощью чисел для представления текста в 10 | электронном виде. 11 | -------------------------------------------------------------------------------- /modules/25-strings/30-encoding/test_code.py: -------------------------------------------------------------------------------- 1 | from hexlet.test import expect_output 2 | 3 | 4 | def test(capsys): 5 | expected = "~\n^\n%" 6 | expect_output(capsys, expected) 7 | -------------------------------------------------------------------------------- /modules/25-strings/description.en.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | name: Strings 4 | description: 5 | Text in programming is called "strings," and this topic is not as simple as it may seem. How do you output a phrase that has both single and double quotes? What is an escape sequence? The module focuses on different aspects of writing text - we'll experiment with the output of different strings and talk about encoding. 6 | -------------------------------------------------------------------------------- /modules/25-strings/description.es.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | name: Cadenas 4 | description: | 5 | En programación, el texto se llama "cadenas" y este tema no es tan sencillo como puede parecer a simple vista. ¿Cómo mostrar una frase que contiene tanto comillas simples como comillas dobles? ¿Qué es una secuencia de escape? Este módulo se enfoca en los diferentes aspectos de la escritura de texto: experimentaremos con la impresión de diferentes cadenas y hablaremos sobre la codificación. 6 | -------------------------------------------------------------------------------- /modules/25-strings/description.ru.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | name: Строки 4 | description: 5 | Текст в программировании называется «строками», и эта тема не так проста, как может показаться. Как вывести фразу, в которой есть и одинарные, и двойные кавычки? Что такое экранированная последовательность? Модуль посвящен разным аспектам написания текста – мы поэкспериментируем с выводом разных строк и поговорим о кодировке. 6 | -------------------------------------------------------------------------------- /modules/30-variables/10-definition/Makefile: -------------------------------------------------------------------------------- 1 | test: 2 | @ test.sh 3 | -------------------------------------------------------------------------------- /modules/30-variables/10-definition/en/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Create a variable named `motto` with the contents `What Is Dead May Never Die!`. Print its contents. 3 | -------------------------------------------------------------------------------- /modules/30-variables/10-definition/en/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: What is a variable 3 | tips: 4 | - > 5 | [Naming in 6 | Programming](https://hexlet.io/blog/posts/code-complete-naming-in-programming) 7 | definitions: 8 | - name: Variable 9 | description: a way to save information and name it for later use in code. 10 | -------------------------------------------------------------------------------- /modules/30-variables/10-definition/es/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Crea una variable llamada `motto` con el contenido `What Is Dead May Never Die!`. Imprime el contenido de la variable. 3 | -------------------------------------------------------------------------------- /modules/30-variables/10-definition/es/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: ¿Qué es una variable? 3 | tips: 4 | - | 5 | [Nomenclatura en programación](https://codica.la/blog/naming-in-programming) 6 | definitions: 7 | - name: Variable 8 | description: >- 9 | una forma de almacenar información y darle un nombre para su uso posterior 10 | en el código. 11 | -------------------------------------------------------------------------------- /modules/30-variables/10-definition/index.py: -------------------------------------------------------------------------------- 1 | motto = "What Is Dead May Never Die!" 2 | print(motto) 3 | -------------------------------------------------------------------------------- /modules/30-variables/10-definition/ru/EXERCISE.md: -------------------------------------------------------------------------------- 1 | Создайте переменную с именем `motto` и содержимым `What Is Dead May Never Die!`. Распечатайте содержимое переменной. 2 | -------------------------------------------------------------------------------- /modules/30-variables/10-definition/ru/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Что такое переменная 3 | tips: 4 | - > 5 | [Именование в 6 | программировании](https://ru.hexlet.io/blog/posts/naming-in-programming?utm_source=code-basics&utm_medium=referral&utm_campaign=blog&utm_content=lesson) 7 | definitions: 8 | - name: Переменная 9 | description: >- 10 | способ сохранить информацию и дать ей имя для последующего использования в 11 | коде. 12 | -------------------------------------------------------------------------------- /modules/30-variables/10-definition/test_code.py: -------------------------------------------------------------------------------- 1 | from hexlet.test import expect_output 2 | 3 | 4 | def test(capsys): 5 | expected = "What Is Dead May Never Die!" 6 | expect_output(capsys, expected) 7 | -------------------------------------------------------------------------------- /modules/30-variables/12-change/Makefile: -------------------------------------------------------------------------------- 1 | test: 2 | @ test.sh 3 | -------------------------------------------------------------------------------- /modules/30-variables/12-change/en/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | In the exercise, a variable is defined with a string inside it. Override the value of this variable and assign it a string in which the characters of the original string are arranged in reverse order. 3 | 4 | Note: in this assignment, you'll have to write code between lines with comments `# BEGIN` and `# END` (we mentioned it before, but this is the first time you've come across this format). 5 | -------------------------------------------------------------------------------- /modules/30-variables/12-change/en/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Changing variables 3 | tips: [] 4 | definitions: 5 | - name: Variable 6 | description: a way to save information and name it for later use in code. 7 | -------------------------------------------------------------------------------- /modules/30-variables/12-change/es/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | En este ejercicio se define una variable que contiene una cadena de texto. Reasigne el valor de esta variable y asígnele una cadena de texto en la que los caracteres de la cadena original estén en orden inverso. 3 | 4 | Tenga en cuenta: en este ejercicio, deberá escribir código entre las líneas de comentarios `# BEGIN` y `# END` (esto se mencionó anteriormente, pero esta es la primera vez que se encuentra con este formato). 5 | -------------------------------------------------------------------------------- /modules/30-variables/12-change/es/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Cambio de variable 3 | tips: [] 4 | definitions: 5 | - name: Variable 6 | description: >- 7 | una forma de almacenar información y darle un nombre para su uso posterior 8 | en el código. 9 | -------------------------------------------------------------------------------- /modules/30-variables/12-change/index.py: -------------------------------------------------------------------------------- 1 | name = "Brienna" 2 | 3 | # BEGIN 4 | name = "anneirB" 5 | # END 6 | 7 | print(name) 8 | -------------------------------------------------------------------------------- /modules/30-variables/12-change/ru/EXERCISE.md: -------------------------------------------------------------------------------- 1 | В упражнении определена переменная, внутри которой содержится строка. Переопределите значение этой переменной и присвойте ей строку, в которой расположите символы первоначальной строки в обратном порядке. 2 | 3 | Обратите внимание: в данном задании вам предстоит писать код между строчками с комментариями `# BEGIN` и `# END` 4 | -------------------------------------------------------------------------------- /modules/30-variables/12-change/ru/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Изменение переменной 3 | tips: [] 4 | definitions: 5 | - name: Переменная 6 | description: >- 7 | способ сохранить информацию и дать ей имя для последующего использования в 8 | коде. 9 | -------------------------------------------------------------------------------- /modules/30-variables/12-change/test_code.py: -------------------------------------------------------------------------------- 1 | from hexlet.test import expect_output 2 | 3 | 4 | def test(capsys): 5 | expected = "anneirB" 6 | expect_output(capsys, expected) 7 | -------------------------------------------------------------------------------- /modules/30-variables/13-variables-naming/Makefile: -------------------------------------------------------------------------------- 1 | test: 2 | @ test.sh 3 | -------------------------------------------------------------------------------- /modules/30-variables/13-variables-naming/en/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Create a variable that describes the number of your brothers and assign it the value *2*. Print its contents. Then compare your name with the name used in the teacher's solution. 3 | -------------------------------------------------------------------------------- /modules/30-variables/13-variables-naming/en/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Choosing a variable's name 3 | tips: 4 | - > 5 | [Naming in 6 | Programming](https://hexlet.io/blog/posts/code-complete-naming-in-programming) 7 | - > 8 | [Naming Mistakes to Avoid in Programming 9 | I](https://hexlet.io/blog/posts/perfect-code-naming-mistakes-to-avoid-in-programming-i) 10 | -------------------------------------------------------------------------------- /modules/30-variables/13-variables-naming/es/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Crea una variable que describa la cantidad de hermanos que tienes y asígnale el valor *2*. Imprime el contenido de la variable. Luego, compara tu nombre con el nombre que se utiliza en la solución del profesor. 3 | -------------------------------------------------------------------------------- /modules/30-variables/13-variables-naming/es/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Elección del nombre de la variable 3 | tips: 4 | - | 5 | [Nomenclatura en programación](https://codica.la/blog/naming-in-programming) 6 | - > 7 | [Errores en la nomenclatura de 8 | variables](https://codica.la/blog/naming-errors-1) 9 | definitions: 10 | - name: Variable 11 | description: >- 12 | una forma de almacenar información y darle un nombre para su uso posterior 13 | en el código. 14 | -------------------------------------------------------------------------------- /modules/30-variables/13-variables-naming/index.py: -------------------------------------------------------------------------------- 1 | my_brothers_count = 2 2 | 3 | print(my_brothers_count) 4 | -------------------------------------------------------------------------------- /modules/30-variables/13-variables-naming/ru/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Создайте переменную, описывающую количество своих братьев, и присвойте ей значение *2*. Распечатайте содержимое переменной. Затем сравните свое имя с именем, которое используется в учительском решении. 3 | -------------------------------------------------------------------------------- /modules/30-variables/13-variables-naming/test_code.py: -------------------------------------------------------------------------------- 1 | from hexlet.test import expect_output 2 | 3 | 4 | def test(capsys): 5 | expected = "2" 6 | expect_output(capsys, expected) 7 | -------------------------------------------------------------------------------- /modules/30-variables/14-errors/Makefile: -------------------------------------------------------------------------------- 1 | test: 2 | @ test.sh 3 | -------------------------------------------------------------------------------- /modules/30-variables/14-errors/en/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Find an undeclared variable in the program and declare it by assigning the value 'Dragon' to it. 3 | 4 | After running the program, the result on the screen should look like this: 5 | 6 |
 7 | Targaryen
 8 |  and
 9 | Dragon
10 | 
11 | -------------------------------------------------------------------------------- /modules/30-variables/14-errors/en/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Errors when working with variables 3 | tips: [] 4 | definitions: 5 | - name: Variable 6 | description: a way to save information and name it for later use in code. 7 | -------------------------------------------------------------------------------- /modules/30-variables/14-errors/es/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Encuentra la variable no declarada en el programa y declárala asignándole el valor 'Dragon'. 3 | 4 | Después de ejecutar el programa, el resultado en la pantalla debería verse así: 5 | 6 |
 7 | Targaryen
 8 |  and
 9 | Dragon
10 | 
11 | -------------------------------------------------------------------------------- /modules/30-variables/14-errors/es/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Errores al trabajar con variables 3 | tips: 4 | - > 5 | [NameError](https://docs.python.org/3/library/exceptions.html?highlight=nameerror#NameError) 6 | definitions: 7 | - name: Variable 8 | description: >- 9 | una forma de almacenar información y darle un nombre para su uso posterior 10 | en el código. 11 | -------------------------------------------------------------------------------- /modules/30-variables/14-errors/index.py: -------------------------------------------------------------------------------- 1 | family = "Targaryen" 2 | 3 | # BEGIN 4 | pet = "Dragon" 5 | # END 6 | 7 | print(family) 8 | print(" and ") 9 | print(pet) 10 | -------------------------------------------------------------------------------- /modules/30-variables/14-errors/ru/EXERCISE.md: -------------------------------------------------------------------------------- 1 | Найдите в программе необъявленную переменную и объявите ее, присвоив ей значение _Dragon_. 2 | 3 | После выполнения программы результат на экране должен выглядеть так: 4 | 5 |
 6 | Targaryen
 7 |  and
 8 | Dragon
 9 | 
10 | -------------------------------------------------------------------------------- /modules/30-variables/14-errors/ru/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Ошибки при работе с переменными 3 | tips: 4 | - > 5 | [NameError](https://docs.python.org/3/library/exceptions.html?highlight=nameerror#NameError) 6 | definitions: 7 | - name: Переменная 8 | description: >- 9 | способ сохранить информацию и дать ей имя для последующего использования в 10 | коде. 11 | -------------------------------------------------------------------------------- /modules/30-variables/14-errors/test_code.py: -------------------------------------------------------------------------------- 1 | from hexlet.test import expect_output 2 | 3 | 4 | def test(capsys): 5 | expected = "Targaryen\n and \nDragon" 6 | expect_output(capsys, expected) 7 | -------------------------------------------------------------------------------- /modules/30-variables/15-variables-expressions/Makefile: -------------------------------------------------------------------------------- 1 | test: 2 | @ test.sh 3 | -------------------------------------------------------------------------------- /modules/30-variables/15-variables-expressions/en/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Write a program that takes the original number of euros written in the variable `euros_count`, converts euros to dollars, and prints it to the screen. Then, it should convert the result to yuans and print it on a new line. 3 | 4 | Example output for 100 euros: 5 | 6 | ``` 7 | 125.0 8 | 863.75 9 | ``` 10 | 11 | For the purposes of the exercise, we'll say that: 12 | - 1 euro = $1.25 13 | - 1 dollar = 6.91 yuans 14 | -------------------------------------------------------------------------------- /modules/30-variables/15-variables-expressions/en/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Expressions in definitions 3 | -------------------------------------------------------------------------------- /modules/30-variables/15-variables-expressions/es/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Escribe un programa que tome una cantidad inicial de euros, almacenada en la variable `euros_count`, convierta los euros a dólares y los muestre en pantalla. Luego, convierte el valor obtenido a yuanes y lo muestra en una nueva línea. 3 | 4 | Ejemplo de salida para 100 euros: 5 | 6 | 7 | ``` 8 | 125.0 9 | 863.75 10 | ``` 11 | 12 | Supongamos que: 13 | - 1 euro = 1.25 dólares 14 | - 1 dólar = 6.91 yuanes 15 | -------------------------------------------------------------------------------- /modules/30-variables/15-variables-expressions/es/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Expresiones en definiciones 3 | tips: 4 | - | 5 | [Expresión](https://es.wikipedia.org/wiki/Expresión_(informática)) 6 | definitions: 7 | - name: Variable 8 | description: >- 9 | una forma de almacenar información y darle un nombre para su posterior uso 10 | en el código. 11 | -------------------------------------------------------------------------------- /modules/30-variables/15-variables-expressions/index.py: -------------------------------------------------------------------------------- 1 | euros_count = 100 2 | 3 | # BEGIN 4 | dollars_count = euros_count * 1.25 5 | print(dollars_count) 6 | yuans_count = dollars_count * 6.91 7 | print(yuans_count) 8 | # END 9 | -------------------------------------------------------------------------------- /modules/30-variables/15-variables-expressions/ru/EXERCISE.md: -------------------------------------------------------------------------------- 1 | Напишите программу, которая берет исходное количество евро, записанное в переменную `euros_count`, переводит евро в доллары и выводит на экран. Затем полученное значение переводит в юани и выводит на новой строчке. 2 | 3 | Пример вывода для 100 евро: 4 | 5 | ``` 6 | 125.0 7 | 863.75 8 | ``` 9 | 10 | Считаем, что: 11 | - 1 евро = 1.25 долларов 12 | - 1 доллар = 6.91 юаней 13 | -------------------------------------------------------------------------------- /modules/30-variables/15-variables-expressions/ru/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Выражения в определениях 3 | tips: 4 | - | 5 | [Выражение](https://ru.wikipedia.org/wiki/Выражение_(информатика)) 6 | definitions: 7 | - name: Переменная 8 | description: >- 9 | способ сохранить информацию и дать ей имя для последующего использования в 10 | коде. 11 | -------------------------------------------------------------------------------- /modules/30-variables/15-variables-expressions/test_code.py: -------------------------------------------------------------------------------- 1 | from hexlet.test import expect_output 2 | 3 | 4 | def test(capsys): 5 | expected = "125.0\n863.75" 6 | expect_output(capsys, expected) 7 | -------------------------------------------------------------------------------- /modules/30-variables/18-variable-concatenation/Makefile: -------------------------------------------------------------------------------- 1 | test: 2 | @ test.sh 3 | -------------------------------------------------------------------------------- /modules/30-variables/18-variable-concatenation/en/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Variables and concatenation 3 | tips: 4 | - > 5 | Consider how you should concatenate the variables to get the two-line output 6 | of the email body. 7 | - > 8 | Remember that you can create a string that contains only the control 9 | sequence `\n`. You can concatenate this string with variables to get proper 10 | text formatting. 11 | -------------------------------------------------------------------------------- /modules/30-variables/18-variable-concatenation/index.py: -------------------------------------------------------------------------------- 1 | info = "We couldn't verify your mother's maiden name." 2 | intro = "Here is important information about your account security." 3 | 4 | first_name = "Joffrey" 5 | greeting = "Hello" 6 | 7 | # BEGIN 8 | print(greeting + ", " + first_name + "!") 9 | print(intro + "\n" + info) 10 | # END 11 | -------------------------------------------------------------------------------- /modules/30-variables/18-variable-concatenation/test_code.py: -------------------------------------------------------------------------------- 1 | from hexlet.test import expect_output 2 | 3 | 4 | def test(capsys): 5 | expected = """Hello, Joffrey! 6 | Here is important information about your account security. 7 | We couldn't verify your mother's maiden name.""" 8 | expect_output(capsys, expected) 9 | -------------------------------------------------------------------------------- /modules/30-variables/19-naming-style/Makefile: -------------------------------------------------------------------------------- 1 | test: 2 | @ test.sh 3 | -------------------------------------------------------------------------------- /modules/30-variables/19-naming-style/en/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Create two variables named «first number» and «second number» in English using snake_case. Write `20` into the first variable and `-100` into the second variable. Print the product of the numbers written in the resulting variables. 3 | 4 | The code will work with any name, and we only check the printed result, so the task is up to you. 5 | -------------------------------------------------------------------------------- /modules/30-variables/19-naming-style/en/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Variable naming 3 | tips: [] 4 | definitions: 5 | - name: Coding standard 6 | description: a set of syntactic and stylistic rules for writing code. 7 | -------------------------------------------------------------------------------- /modules/30-variables/19-naming-style/es/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Crea dos variables con los nombres "primer número" y "segundo número" en inglés utilizando snake_case. Asigna el número `20` a la primera variable y `-100` a la segunda. Imprime en pantalla el producto de los números almacenados en las variables resultantes. 3 | 4 | El código funcionará con cualquier nombre, y nuestro sistema siempre verifica solamente el resultado en pantalla, por lo que completar esta tarea es tu responsabilidad. 5 | -------------------------------------------------------------------------------- /modules/30-variables/19-naming-style/es/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Nomenclatura de variables 3 | tips: 4 | - | 5 | [Snake case](https://es.wikipedia.org/wiki/Snake_case) 6 | definitions: 7 | - name: Estándar de codificación 8 | description: conjunto de reglas sintácticas y estilísticas para escribir código. 9 | -------------------------------------------------------------------------------- /modules/30-variables/19-naming-style/index.py: -------------------------------------------------------------------------------- 1 | first_number = 20 2 | second_number = -100 3 | 4 | print(first_number * second_number) 5 | -------------------------------------------------------------------------------- /modules/30-variables/19-naming-style/ru/EXERCISE.md: -------------------------------------------------------------------------------- 1 | Создайте две переменные с именами «первое число» и «второе число» на английском языке используя snake_case. Запишите в первую переменную число `20`, во вторую — `-100`. Выведите на экран произведение чисел, записанных в получившиеся переменные. 2 | 3 | Код будет работать с любыми названиями, а наша система всегда проверяет только результат на экране, поэтому выполнение этого задания — под вашу ответственность. 4 | -------------------------------------------------------------------------------- /modules/30-variables/19-naming-style/ru/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Именование переменных 3 | tips: 4 | - | 5 | [Snake case](https://ru.wikipedia.org/wiki/Snake_case) 6 | definitions: 7 | - name: Стандарт кодирования 8 | description: набор синтаксических и стилистических правил написания кода. 9 | -------------------------------------------------------------------------------- /modules/30-variables/19-naming-style/test_code.py: -------------------------------------------------------------------------------- 1 | from hexlet.test import expect_output 2 | 3 | 4 | def test(capsys): 5 | expected = "-2000" 6 | expect_output(capsys, expected) 7 | -------------------------------------------------------------------------------- /modules/30-variables/20-magic-numbers/Makefile: -------------------------------------------------------------------------------- 1 | test: 2 | @ test.sh 3 | -------------------------------------------------------------------------------- /modules/30-variables/20-magic-numbers/en/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Magic numbers 3 | tips: [] 4 | -------------------------------------------------------------------------------- /modules/30-variables/20-magic-numbers/es/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Números mágicos 3 | tips: 4 | - | 5 | [Números mágicos](https://es.wikipedia.org/wiki/Número_mágico_(informática)) 6 | -------------------------------------------------------------------------------- /modules/30-variables/20-magic-numbers/index.py: -------------------------------------------------------------------------------- 1 | king = "Rooms in King Balon's Castles:" 2 | 3 | # BEGIN 4 | number_of_castles = 6 5 | rooms_per_castle = 17 6 | print(king) 7 | print(number_of_castles * rooms_per_castle) 8 | # END 9 | -------------------------------------------------------------------------------- /modules/30-variables/20-magic-numbers/ru/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Магические числа 3 | tips: 4 | - > 5 | [Магические 6 | числа](https://ru.wikipedia.org/wiki/Магическое_число_(программирование)) 7 | -------------------------------------------------------------------------------- /modules/30-variables/20-magic-numbers/test_code.py: -------------------------------------------------------------------------------- 1 | from hexlet.test import expect_output 2 | 3 | 4 | def test(capsys): 5 | expected = "Rooms in King Balon's Castles:\n102" 6 | expect_output(capsys, expected) 7 | -------------------------------------------------------------------------------- /modules/30-variables/23-constants/Makefile: -------------------------------------------------------------------------------- 1 | test: 2 | @ test.sh 3 | -------------------------------------------------------------------------------- /modules/30-variables/23-constants/en/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Create a constant `DRAGONS_BORN_COUNT` and write the number 3 in it, which is the number of dragons born to Daenerys. 3 | -------------------------------------------------------------------------------- /modules/30-variables/23-constants/en/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Constants 3 | tips: [] 4 | definitions: 5 | - name: Constant 6 | description: >- 7 | a way to store information and name it for later use in code; constants 8 | cannot be changed, unlike variables. 9 | -------------------------------------------------------------------------------- /modules/30-variables/23-constants/es/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Crea la constante `DRAGONS_BORN_COUNT` y asígnale el valor de 3, que es la cantidad de dragones nacidos de Daenerys. 3 | -------------------------------------------------------------------------------- /modules/30-variables/23-constants/es/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Constantes 3 | tips: [] 4 | definitions: 5 | - name: Constante 6 | description: >- 7 | una forma de almacenar información y darle un nombre para su uso posterior 8 | en el código; las constantes no se pueden modificar, a diferencia de las 9 | variables. 10 | -------------------------------------------------------------------------------- /modules/30-variables/23-constants/index.py: -------------------------------------------------------------------------------- 1 | DRAGONS_BORN_COUNT = 3 2 | -------------------------------------------------------------------------------- /modules/30-variables/23-constants/ru/EXERCISE.md: -------------------------------------------------------------------------------- 1 | Создайте константу `DRAGONS_BORN_COUNT` и запишите в неё число 3 — это количество драконов, родившихся у Дайенерис. 2 | -------------------------------------------------------------------------------- /modules/30-variables/23-constants/ru/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Константы 3 | tips: [] 4 | definitions: 5 | - name: Константа 6 | description: >- 7 | способ сохранить информацию и дать ей имя для последующего использования в 8 | коде; константы нельзя изменять, в отличие от переменных. 9 | -------------------------------------------------------------------------------- /modules/30-variables/23-constants/test_code.py: -------------------------------------------------------------------------------- 1 | import index 2 | 3 | 4 | def test1(): 5 | assert index.DRAGONS_BORN_COUNT == 3 6 | -------------------------------------------------------------------------------- /modules/30-variables/description.en.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | name: Variables 4 | description: 5 | Information can be put into special "repositories" and then used as many times as you like. These storages are called variables, and they help simplify code and reduce unnecessary repetition. 6 | -------------------------------------------------------------------------------- /modules/30-variables/description.es.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | name: Variables 4 | description: 5 | La información se puede colocar en "almacenes" especiales y luego utilizarla tantas veces como sea necesario. Estos almacenes se llaman variables y ayudan a simplificar el código y reducir repeticiones innecesarias. 6 | -------------------------------------------------------------------------------- /modules/30-variables/description.ru.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | name: Переменные 4 | description: 5 | Информацию можно помещать в специальные «хранилища», а потом использовать сколько угодно раз. Эти хранилища называются переменными, и они помогают упростить код и сократить лишние повторения. 6 | -------------------------------------------------------------------------------- /modules/31-advanced-strings/25-interpolation/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hexlet-basics/exercises-python/d551f48fe1a363482a9a5e0019190fffbe36a8bd/modules/31-advanced-strings/25-interpolation/.DS_Store -------------------------------------------------------------------------------- /modules/31-advanced-strings/25-interpolation/Makefile: -------------------------------------------------------------------------------- 1 | test: 2 | @ test.sh 3 | -------------------------------------------------------------------------------- /modules/31-advanced-strings/25-interpolation/en/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Print the string, `Do you want to eat, ? Where the variable `stark` should be used instead of ``. The output should look like this: 3 | 4 |
5 | Do you want to eat, Arya?
6 | 
7 | -------------------------------------------------------------------------------- /modules/31-advanced-strings/25-interpolation/en/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Interpolation 3 | tips: [] 4 | definitions: 5 | - name: Interpolation 6 | description: >- 7 | a method for obtaining a complex string from several simple ones using 8 | special templates 9 | -------------------------------------------------------------------------------- /modules/31-advanced-strings/25-interpolation/es/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Imprime en pantalla la cadena `Do you want to eat, ?`, donde en lugar de `` se debe utilizar la variable `stark`. La salida debe ser la siguiente: 3 | 4 |
5 | Do you want to eat, Arya?
6 | 
7 | -------------------------------------------------------------------------------- /modules/31-advanced-strings/25-interpolation/es/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Interpolación 3 | tips: 4 | - > 5 | [f-strings](https://docs.python.org/3/tutorial/inputoutput.html#fancier-output-formatting) 6 | definitions: 7 | - name: Interpolación 8 | description: >- 9 | una forma de obtener una cadena compleja a partir de varias cadenas 10 | simples utilizando plantillas especiales. 11 | -------------------------------------------------------------------------------- /modules/31-advanced-strings/25-interpolation/index.py: -------------------------------------------------------------------------------- 1 | stark = "Arya" 2 | 3 | # BEGIN 4 | print(f"Do you want to eat, {stark}?") 5 | # END 6 | -------------------------------------------------------------------------------- /modules/31-advanced-strings/25-interpolation/ru/EXERCISE.md: -------------------------------------------------------------------------------- 1 | Выведите на экран строку `Do you want to eat, ?`. Где вместо `` должна использоваться переменная `stark`. Вывод должен получиться таким: 2 | 3 |
4 | Do you want to eat, Arya?
5 | 
6 | -------------------------------------------------------------------------------- /modules/31-advanced-strings/25-interpolation/ru/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Интерполяция 3 | tips: 4 | - > 5 | [f-строки](https://docs.python.org/3/tutorial/inputoutput.html#fancier-output-formatting) 6 | definitions: 7 | - name: Интерполяция 8 | description: >- 9 | способ получения сложной строки из нескольких простых с использованием 10 | специальных шаблонов 11 | -------------------------------------------------------------------------------- /modules/31-advanced-strings/25-interpolation/test_code.py: -------------------------------------------------------------------------------- 1 | from hexlet.test import expect_output 2 | 3 | 4 | def test(capsys): 5 | expected = "Do you want to eat, Arya?" 6 | expect_output(capsys, expected) 7 | -------------------------------------------------------------------------------- /modules/31-advanced-strings/30-symbols/Makefile: -------------------------------------------------------------------------------- 1 | test: 2 | @ test.sh 3 | -------------------------------------------------------------------------------- /modules/31-advanced-strings/30-symbols/en/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Display the last character of the string in the `name` variable 3 | -------------------------------------------------------------------------------- /modules/31-advanced-strings/30-symbols/en/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Extracting characters from a string 3 | tips: [] 4 | -------------------------------------------------------------------------------- /modules/31-advanced-strings/30-symbols/es/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Imprime en pantalla el último carácter de la cadena que se encuentra en la variable `name`. 3 | -------------------------------------------------------------------------------- /modules/31-advanced-strings/30-symbols/es/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Extracción de caracteres de una cadena 3 | tips: [] 4 | definitions: 5 | - name: Índice 6 | description: La posición del carácter dentro de una cadena. 7 | -------------------------------------------------------------------------------- /modules/31-advanced-strings/30-symbols/index.py: -------------------------------------------------------------------------------- 1 | name = "Na\nharis" 2 | 3 | # BEGIN 4 | print(name[7]) 5 | # END 6 | -------------------------------------------------------------------------------- /modules/31-advanced-strings/30-symbols/ru/EXERCISE.md: -------------------------------------------------------------------------------- 1 | Выведите на экран последний символ строки, находящейся в переменной `name` 2 | -------------------------------------------------------------------------------- /modules/31-advanced-strings/30-symbols/ru/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Извлечение символов из строки 3 | tips: [] 4 | definitions: 5 | - name: Индекс 6 | description: позиция символа внутри строки. 7 | -------------------------------------------------------------------------------- /modules/31-advanced-strings/30-symbols/test_code.py: -------------------------------------------------------------------------------- 1 | from hexlet.test import expect_output 2 | 3 | 4 | def test(capsys): 5 | expected = "s" 6 | expect_output(capsys, expected) 7 | -------------------------------------------------------------------------------- /modules/31-advanced-strings/70-slices/Makefile: -------------------------------------------------------------------------------- 1 | test: 2 | @ test.sh 3 | -------------------------------------------------------------------------------- /modules/31-advanced-strings/70-slices/en/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | The variable `value` contains the value `Hexlet`. Extract from it and display the slice that gets the substring `xle`. This task can be done in different ways. 3 | -------------------------------------------------------------------------------- /modules/31-advanced-strings/70-slices/en/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Line slices 3 | tips: [] 4 | -------------------------------------------------------------------------------- /modules/31-advanced-strings/70-slices/es/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | La variable `value` contiene el valor `Hexlet`. Extrae y muestra en pantalla un recorte que obtenga la subcadena `xle` de ella. Puedes hacer esto de diferentes maneras. 3 | -------------------------------------------------------------------------------- /modules/31-advanced-strings/70-slices/es/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Recortes de cadenas 3 | tips: 4 | - > 5 | [Más información sobre recortes en 6 | Python](https://www.w3schools.com/python/python_strings_slicing.asp) 7 | definitions: 8 | - name: Recortes de cadenas 9 | description: >- 10 | mecanismo mediante el cual se extrae una subcadena según los parámetros 11 | especificados. 12 | -------------------------------------------------------------------------------- /modules/31-advanced-strings/70-slices/index.py: -------------------------------------------------------------------------------- 1 | value = "Hexlet" 2 | 3 | # BEGIN 4 | print(value[2:5]) 5 | # END 6 | -------------------------------------------------------------------------------- /modules/31-advanced-strings/70-slices/ru/EXERCISE.md: -------------------------------------------------------------------------------- 1 | В переменной `value` лежит значение `Hexlet`. Извлеките из него и выведите на экран срез, который получит подстроку `xle`. Это задание можно сделать разными способами. 2 | -------------------------------------------------------------------------------- /modules/31-advanced-strings/70-slices/ru/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Срезы строк 3 | tips: 4 | - > 5 | [Подробнее о срезах в 6 | Python](https://www.w3schools.com/python/python_strings_slicing.asp) 7 | definitions: 8 | - name: Срезы для строк 9 | description: >- 10 | механизм, с помощью которого извлекается подстрока по указанным 11 | параметрам. 12 | -------------------------------------------------------------------------------- /modules/31-advanced-strings/70-slices/test_code.py: -------------------------------------------------------------------------------- 1 | from hexlet.test import expect_output 2 | 3 | 4 | def test(capsys): 5 | expected = "xle" 6 | expect_output(capsys, expected) 7 | -------------------------------------------------------------------------------- /modules/31-advanced-strings/90-multiline-strings/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hexlet-basics/exercises-python/d551f48fe1a363482a9a5e0019190fffbe36a8bd/modules/31-advanced-strings/90-multiline-strings/.DS_Store -------------------------------------------------------------------------------- /modules/31-advanced-strings/90-multiline-strings/Makefile: -------------------------------------------------------------------------------- 1 | test: 2 | @ test.sh 3 | -------------------------------------------------------------------------------- /modules/31-advanced-strings/90-multiline-strings/en/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Write the text below into the `text` variable. Use triple quotes. 3 | 4 | ``` 5 | Lannister, Targaryen, Baratheon, Stark, Tyrell... 6 | they're all just spokes on a wheel. 7 | This one's on top, then that one's on top, and on and on it spins, 8 | crushing those on the ground. 9 | ``` 10 | -------------------------------------------------------------------------------- /modules/31-advanced-strings/90-multiline-strings/en/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Multi-line strings 3 | definitions: [] 4 | tips: [] 5 | -------------------------------------------------------------------------------- /modules/31-advanced-strings/90-multiline-strings/es/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Asigna el siguiente texto a la variable `text` utilizando triples comillas. 3 | 4 | ``` 5 | Lannister, Targaryen, Baratheon, Stark, Tyrell... 6 | they're all just spokes on a wheel. 7 | This one's on top, then that one's on top, and on and on it spins, 8 | crushing those on the ground. 9 | ``` 10 | -------------------------------------------------------------------------------- /modules/31-advanced-strings/90-multiline-strings/es/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Cadenas de varias líneas 3 | definitions: [] 4 | tips: 5 | - > 6 | [Cadenas de varias 7 | líneas](https://www.w3schools.com/python/gloss_python_multi_line_strings.asp) 8 | -------------------------------------------------------------------------------- /modules/31-advanced-strings/90-multiline-strings/index.py: -------------------------------------------------------------------------------- 1 | # BEGIN 2 | text = """Lannister, Targaryen, Baratheon, Stark, Tyrell... 3 | they're all just spokes on a wheel. 4 | This one's on top, then that one's on top, and on and on it spins, 5 | crushing those on the ground.""" 6 | # END 7 | 8 | print(text) 9 | -------------------------------------------------------------------------------- /modules/31-advanced-strings/90-multiline-strings/ru/EXERCISE.md: -------------------------------------------------------------------------------- 1 | Запишите в переменную `text` текст, который приведен ниже. Используйте тройные кавычки. 2 | 3 | ``` 4 | Lannister, Targaryen, Baratheon, Stark, Tyrell... 5 | they're all just spokes on a wheel. 6 | This one's on top, then that one's on top, and on and on it spins, 7 | crushing those on the ground. 8 | ``` 9 | -------------------------------------------------------------------------------- /modules/31-advanced-strings/90-multiline-strings/ru/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Multi-line строки 3 | definitions: [] 4 | tips: 5 | - > 6 | [Multi-line 7 | строки](https://www.w3schools.com/python/gloss_python_multi_line_strings.asp) 8 | -------------------------------------------------------------------------------- /modules/31-advanced-strings/90-multiline-strings/test_code.py: -------------------------------------------------------------------------------- 1 | from hexlet.test import expect_output 2 | 3 | 4 | def test(capsys): 5 | expected = """Lannister, Targaryen, Baratheon, Stark, Tyrell... 6 | they're all just spokes on a wheel. 7 | This one's on top, then that one's on top, and on and on it spins, 8 | crushing those on the ground.""" 9 | expect_output(capsys, expected) 10 | -------------------------------------------------------------------------------- /modules/31-advanced-strings/description.en.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | name: Deeper About Lines 4 | description: 5 | Continuing to study strings and their relationship to variables. We'll take a look at interpolation, character extraction, slice, and more. 6 | -------------------------------------------------------------------------------- /modules/31-advanced-strings/description.es.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | name: Más sobre cadenas de texto 4 | description: 5 | Continuamos aprendiendo sobre cadenas de texto y su relación con las variables. Exploramos la interpolación, extracción de caracteres, slices y más. 6 | -------------------------------------------------------------------------------- /modules/31-advanced-strings/description.ru.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | name: Глубже про строки 4 | description: 5 | Продолжаем изучать строки и их связь с переменными. Разбираем интерполяцию, извлечение символов, слайсы и другое 6 | -------------------------------------------------------------------------------- /modules/33-data-types/40-primitive-data-types/Makefile: -------------------------------------------------------------------------------- 1 | test: 2 | @ test.sh 3 | -------------------------------------------------------------------------------- /modules/33-data-types/40-primitive-data-types/en/EXERCISE.md: -------------------------------------------------------------------------------- 1 | Display the number `-0.304`. 2 | -------------------------------------------------------------------------------- /modules/33-data-types/40-primitive-data-types/es/EXERCISE.md: -------------------------------------------------------------------------------- 1 | Imprime en pantalla el número `-0.304`. 2 | -------------------------------------------------------------------------------- /modules/33-data-types/40-primitive-data-types/index.py: -------------------------------------------------------------------------------- 1 | print(-0.304) 2 | -------------------------------------------------------------------------------- /modules/33-data-types/40-primitive-data-types/ru/EXERCISE.md: -------------------------------------------------------------------------------- 1 | Выведите на экран число `-0.304`. 2 | -------------------------------------------------------------------------------- /modules/33-data-types/40-primitive-data-types/test_code.py: -------------------------------------------------------------------------------- 1 | from hexlet.test import expect_output 2 | 3 | 4 | def test(capsys): 5 | expected = "-0.304" 6 | expect_output(capsys, expected) 7 | -------------------------------------------------------------------------------- /modules/33-data-types/50-strong-typing/Makefile: -------------------------------------------------------------------------------- 1 | test: 2 | @ test.sh 3 | -------------------------------------------------------------------------------- /modules/33-data-types/50-strong-typing/en/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Print the result of the expression: `7 - (-8 - -2)`. Try to make the number 7 a string instead of a number. Experiment with other numbers too. 3 | -------------------------------------------------------------------------------- /modules/33-data-types/50-strong-typing/en/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Strong (or Strict) Typing 3 | tips: [] 4 | -------------------------------------------------------------------------------- /modules/33-data-types/50-strong-typing/es/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Muestre en pantalla el resultado de la expresión: `7 - (-8 - -2)`. Intente hacer que el número 7 sea una cadena de texto en lugar de un número. ¿Funcionará este código? Experimente también con otros números. 3 | -------------------------------------------------------------------------------- /modules/33-data-types/50-strong-typing/es/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Tipado fuerte (o estricto) 3 | tips: 4 | - | 5 | [Tipado](https://en.wikipedia.org/wiki/Strong_and_weak_typing) 6 | -------------------------------------------------------------------------------- /modules/33-data-types/50-strong-typing/index.py: -------------------------------------------------------------------------------- 1 | print(7 - (-8 - -2)) 2 | -------------------------------------------------------------------------------- /modules/33-data-types/50-strong-typing/ru/EXERCISE.md: -------------------------------------------------------------------------------- 1 | Выведите на экран результат выражения: `7 - (-8 - -2)`. Попробуйте сделать число 7 не числом, а строкой. Сработает ли такой код? Поэкспериментируйте с другими числами тоже. 2 | -------------------------------------------------------------------------------- /modules/33-data-types/50-strong-typing/ru/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Сильная (или Строгая) типизация 3 | tips: 4 | - | 5 | [Типизация](https://ru.wikipedia.org/wiki/Сильная_и_слабая_типизация) 6 | -------------------------------------------------------------------------------- /modules/33-data-types/50-strong-typing/test_code.py: -------------------------------------------------------------------------------- 1 | from hexlet.test import expect_output 2 | 3 | 4 | def test(capsys): 5 | expected = "13" 6 | expect_output(capsys, expected) 7 | -------------------------------------------------------------------------------- /modules/33-data-types/52-data-types-immutability/Makefile: -------------------------------------------------------------------------------- 1 | test: 2 | @ test.sh 3 | -------------------------------------------------------------------------------- /modules/33-data-types/52-data-types-immutability/en/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: | 3 | The immutability of primitive types 4 | tips: [] 5 | definitions: [] 6 | -------------------------------------------------------------------------------- /modules/33-data-types/52-data-types-immutability/es/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: | 3 | Inmutabilidad de los tipos de datos primitivos 4 | tips: [] 5 | definitions: 6 | - name: Inmutabilidad 7 | description: > 8 | estado en el que un objeto o variable no puede ser cambiado después de su 9 | creación 10 | -------------------------------------------------------------------------------- /modules/33-data-types/52-data-types-immutability/index.py: -------------------------------------------------------------------------------- 1 | one = "Naharis" 2 | two = "Mormont" 3 | three = "Sand" 4 | 5 | # BEGIN 6 | print(f"{one[2]}{two[1]}{three[3]}{two[4]}{two[2]}") 7 | # END 8 | -------------------------------------------------------------------------------- /modules/33-data-types/52-data-types-immutability/ru/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: | 3 | Неизменяемость примитивных типов 4 | tips: [] 5 | definitions: 6 | - name: Неизменяемость 7 | description: > 8 | состояние, при котором объект, переменная не могут быть изменены после 9 | создания 10 | -------------------------------------------------------------------------------- /modules/33-data-types/52-data-types-immutability/test_code.py: -------------------------------------------------------------------------------- 1 | from hexlet.test import expect_output 2 | 3 | 4 | def test(capsys): 5 | expected = "hodor" 6 | expect_output(capsys, expected) 7 | -------------------------------------------------------------------------------- /modules/33-data-types/55-data-types-casting/Makefile: -------------------------------------------------------------------------------- 1 | test: 2 | @ test.sh 3 | -------------------------------------------------------------------------------- /modules/33-data-types/55-data-types-casting/en/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Output the string `2 times` obtained from the number 2.9 (stored in the variable `value`) and the string `times` using type conversions and concatenation. To do this, perform two conversions: first to an integer and then to a string 3 | 4 |
5 | 2 times
6 | 
7 | -------------------------------------------------------------------------------- /modules/33-data-types/55-data-types-casting/en/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Explicit type conversion 3 | -------------------------------------------------------------------------------- /modules/33-data-types/55-data-types-casting/es/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Imprime en la pantalla la cadena de texto `2 times`, obtenida a partir del número 2.9 (almacenado en la variable `value`) y la cadena de texto `times`, utilizando conversiones de tipos y concatenación. Para lograrlo, debes realizar dos conversiones: primero a un número entero y luego a una cadena de texto. 3 | 4 |
5 | 2 times
6 | 
7 | -------------------------------------------------------------------------------- /modules/33-data-types/55-data-types-casting/es/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Conversión explícita de tipos 3 | tips: 4 | - | 5 | [Tipado](https://es.wikipedia.org/wiki/Tipado) 6 | -------------------------------------------------------------------------------- /modules/33-data-types/55-data-types-casting/index.py: -------------------------------------------------------------------------------- 1 | value = 2.9 2 | 3 | # BEGIN 4 | int_value = int(value) 5 | str_value = str(int_value) 6 | print(str_value + " times") 7 | # END 8 | -------------------------------------------------------------------------------- /modules/33-data-types/55-data-types-casting/ru/EXERCISE.md: -------------------------------------------------------------------------------- 1 | Выведите на экран строку `2 times`, полученную из числа 2.9 (хранится в переменной `value`) и строки `times`, используя преобразования типов и конкатенацию. Для этого нужно выполнить два преобразования: сначала в целое число, а затем в строку 2 | 3 |
4 | 2 times
5 | 
6 | -------------------------------------------------------------------------------- /modules/33-data-types/55-data-types-casting/ru/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Явное преобразование типов 3 | tips: 4 | - | 5 | [Типизация](https://ru.wikipedia.org/wiki/Сильная_и_слабая_типизация) 6 | -------------------------------------------------------------------------------- /modules/33-data-types/55-data-types-casting/test_code.py: -------------------------------------------------------------------------------- 1 | from hexlet.test import expect_output 2 | 3 | 4 | def test(capsys): 5 | expected = "2 times" 6 | expect_output(capsys, expected) 7 | -------------------------------------------------------------------------------- /modules/33-data-types/description.en.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | name: Data types 4 | description: 5 | Python is a language with strong typing and immutable primitive data types. What happens when we try to multiply a number by a string? How does Python know what type of data is in front of it? What is type conversion? You will find the answers to these questions in the current module. 6 | -------------------------------------------------------------------------------- /modules/33-data-types/description.es.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | name: Tipos de datos 4 | description: 5 | Python es un lenguaje con una tipificación sólida y tipos de datos primitivos e inmutables. ¿Qué sucede si intentamos multiplicar un número por una cadena? ¿Cómo Python entiende qué tipo de dato tiene ante sí? ¿Qué es la conversión de tipos? Encontrarás las respuestas a estas preguntas en el módulo actual. 6 | -------------------------------------------------------------------------------- /modules/33-data-types/description.ru.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | name: Типы данных 4 | description: 5 | Python – язык с сильной типизацией и неизменяемыми примитивными типами данных. Что произойдет, если мы попробуем умножить число на строку? Каким образом Python понимает, что за тип данных перед ним? Что такое преобразование типов? Ответы на эти вопросы вы найдете в текущем модуле. 6 | -------------------------------------------------------------------------------- /modules/35-calling-functions/100-call/Makefile: -------------------------------------------------------------------------------- 1 | test: 2 | @ test.sh 3 | -------------------------------------------------------------------------------- /modules/35-calling-functions/100-call/en/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | There are two variables defined in the program code that contain the names of companies. Calculate their total character length and print it. 3 | -------------------------------------------------------------------------------- /modules/35-calling-functions/100-call/en/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Functions 3 | tips: [] 4 | -------------------------------------------------------------------------------- /modules/35-calling-functions/100-call/es/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | En el código del programa se han definido dos variables que contienen nombres de empresas. Calcula la longitud total de los nombres en caracteres y muéstrala en pantalla. 3 | -------------------------------------------------------------------------------- /modules/35-calling-functions/100-call/es/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Funciones y su ejecución 3 | tips: [] 4 | definitions: 5 | - name: Función 6 | description: >- 7 | operación que puede recibir datos y devolver un resultado; se llama a una 8 | función de esta manera: `foo()`. 9 | - name: Argumento 10 | description: >- 11 | información que una función recibe al ser ejecutada. Por ejemplo, 12 | `foo(42)` es pasar el argumento `42` a la función `foo()`. 13 | -------------------------------------------------------------------------------- /modules/35-calling-functions/100-call/index.py: -------------------------------------------------------------------------------- 1 | company1 = "Apple" 2 | company2 = "Samsung" 3 | 4 | # BEGIN 5 | company1_len = len(company1) 6 | company2_len = len(company2) 7 | 8 | print(company1_len + company2_len) 9 | # END 10 | -------------------------------------------------------------------------------- /modules/35-calling-functions/100-call/ru/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | В коде программы определены две переменные, содержащие имена компаний. Посчитайте их общую длину в символах и выведите ее на экран. 3 | -------------------------------------------------------------------------------- /modules/35-calling-functions/100-call/ru/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Функции и их вызов 3 | tips: [] 4 | definitions: 5 | - name: Функция 6 | description: >- 7 | операция, способная принимать данные и возвращать результат; функция 8 | вызывается так: `foo()`. 9 | - name: Аргумент 10 | description: >- 11 | информация, которую функция получает при вызове. Например, `foo(42)` — 12 | передача аргумента `42` функции `foo()` 13 | -------------------------------------------------------------------------------- /modules/35-calling-functions/100-call/test_code.py: -------------------------------------------------------------------------------- 1 | from hexlet.test import expect_output 2 | 3 | 4 | def test(capsys): 5 | expected = "12" 6 | expect_output(capsys, expected) 7 | -------------------------------------------------------------------------------- /modules/35-calling-functions/120-function-signature/Makefile: -------------------------------------------------------------------------------- 1 | test: 2 | @ test.sh 3 | -------------------------------------------------------------------------------- /modules/35-calling-functions/120-function-signature/en/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Now it's your turn, look at the signature of a function in the documentation and work out how to use it. 3 | 4 | Python has a function called `hex()`. Study its signature [here](https://docs-python.ru/tutorial/vstroennye-funktsii-interpretatora-python/funktsija-hex/). 5 | 6 | Write a program that uses the `hex()` function with the variable `number` and displays the result on the screen. 7 | -------------------------------------------------------------------------------- /modules/35-calling-functions/120-function-signature/en/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Function Signature 3 | tips: [] 4 | definitions: 5 | - name: Function Signature 6 | description: >- 7 | a formal description of the types of arguments and the type of the 8 | function's return value. 9 | -------------------------------------------------------------------------------- /modules/35-calling-functions/120-function-signature/es/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Ahora es tu turno de revisar la firma de una función en la documentación y comprender cómo usarla. 3 | 4 | En Python, hay una función llamada `hex()`. Estudia su firma en la [página de documentación](https://docs.python.org/3/library/functions.html#hex). 5 | 6 | Escribe un programa que muestre en pantalla el resultado de llamar a la función `hex()` con la variable `number` como parámetro. 7 | -------------------------------------------------------------------------------- /modules/35-calling-functions/120-function-signature/es/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Firma de la función 3 | tips: 4 | - > 5 | [Función 6 | pow()](https://docs.python.org/3/library/functions.html?highlight=pow#pow) 7 | definitions: 8 | - name: Firma de la función 9 | description: >- 10 | descripción formal de los tipos de argumentos y el tipo de valor devuelto 11 | por una función. 12 | -------------------------------------------------------------------------------- /modules/35-calling-functions/120-function-signature/index.py: -------------------------------------------------------------------------------- 1 | number = 255 2 | 3 | # BEGIN 4 | print(hex(number)) 5 | # END 6 | -------------------------------------------------------------------------------- /modules/35-calling-functions/120-function-signature/ru/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Теперь ваша очередь посмотреть на сигнатуру функции в документации и разобраться, как её использовать. 3 | 4 | В Python есть функция `hex()`. Изучите её сигнатуру на [странице документации](https://docs-python.ru/tutorial/vstroennye-funktsii-interpretatora-python/funktsija-hex/). 5 | 6 | Напишите программу, которая выведет на экран результат работы функции `hex()` с переменной `number` в качестве параметра. 7 | -------------------------------------------------------------------------------- /modules/35-calling-functions/120-function-signature/ru/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Сигнатура функции 3 | tips: 4 | - > 5 | [Функция 6 | pow()](https://docs.python.org/3/library/functions.html?highlight=pow#pow) 7 | definitions: 8 | - name: Сигнатура функции 9 | description: >- 10 | формальное описание типов аргументов и типа возвращаемого значения 11 | функции. 12 | -------------------------------------------------------------------------------- /modules/35-calling-functions/120-function-signature/test_code.py: -------------------------------------------------------------------------------- 1 | from hexlet.test import expect_output 2 | 3 | 4 | def test(capsys): 5 | expected = "0xff" 6 | expect_output(capsys, expected) 7 | -------------------------------------------------------------------------------- /modules/35-calling-functions/135-calling-functions-default-arguments/Makefile: -------------------------------------------------------------------------------- 1 | test: 2 | @ test.sh 3 | -------------------------------------------------------------------------------- /modules/35-calling-functions/135-calling-functions-default-arguments/en/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Round up the number written in the `number` variable to two decimal places and print the result on the screen. 3 | -------------------------------------------------------------------------------- /modules/35-calling-functions/135-calling-functions-default-arguments/en/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Default Arguments 3 | tips: [] 4 | definitions: 5 | - name: Default setting 6 | description: optional function parameter 7 | -------------------------------------------------------------------------------- /modules/35-calling-functions/135-calling-functions-default-arguments/es/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Redondea el número almacenado en la variable `number` a dos decimales y muestra el resultado en pantalla. 3 | -------------------------------------------------------------------------------- /modules/35-calling-functions/135-calling-functions-default-arguments/es/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Argumentos por defecto 3 | tips: [] 4 | definitions: 5 | - name: Parámetro por defecto 6 | description: parámetro opcional de una función 7 | -------------------------------------------------------------------------------- /modules/35-calling-functions/135-calling-functions-default-arguments/index.py: -------------------------------------------------------------------------------- 1 | number = 10.1234 2 | 3 | # BEGIN 4 | print(round(number, 2)) 5 | # END 6 | -------------------------------------------------------------------------------- /modules/35-calling-functions/135-calling-functions-default-arguments/ru/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Округлите число, записанное в переменную `number`, до двух знаков после запятой и выведите результат на экран. 3 | -------------------------------------------------------------------------------- /modules/35-calling-functions/135-calling-functions-default-arguments/ru/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Аргументы по умолчанию 3 | tips: [] 4 | definitions: 5 | - name: Параметр по умолчанию 6 | description: необязательный параметр функции 7 | -------------------------------------------------------------------------------- /modules/35-calling-functions/135-calling-functions-default-arguments/test_code.py: -------------------------------------------------------------------------------- 1 | from hexlet.test import expect_output 2 | 3 | 4 | def test(capsys): 5 | expected = "10.12" 6 | expect_output(capsys, expected) 7 | -------------------------------------------------------------------------------- /modules/35-calling-functions/150-calling-funcitons-expression/Makefile: -------------------------------------------------------------------------------- 1 | test: 2 | @ test.sh 3 | -------------------------------------------------------------------------------- /modules/35-calling-functions/150-calling-funcitons-expression/en/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Display the first and last letters of the sentence written in the `text` variable in the following format: 3 | 4 |
 5 | First: N
 6 | Last: t
 7 | 
8 | 9 | Try to create only one variable to be assigned to the text to before you print it. In this lesson, we're practicing building a compound expression. 10 | -------------------------------------------------------------------------------- /modules/35-calling-functions/150-calling-funcitons-expression/en/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Function call - expressions 3 | -------------------------------------------------------------------------------- /modules/35-calling-functions/150-calling-funcitons-expression/es/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Imprime en pantalla la primera y la última letra de la oración almacenada en la variable `texto`, en el siguiente formato: 3 | 4 |
 5 | First: N
 6 | Last: t
 7 | 
8 | 9 | Intenta crear solo una variable en la que se almacene el texto necesario antes de imprimirlo en pantalla. En esta lección, estamos practicando cómo construir una expresión compuesta. 10 | -------------------------------------------------------------------------------- /modules/35-calling-functions/150-calling-funcitons-expression/es/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Llamada a una función - expresión 3 | definitions: 4 | - name: Expresión 5 | description: > 6 | una secuencia de acciones sobre datos que conduce a un resultado que se 7 | puede utilizar. 8 | -------------------------------------------------------------------------------- /modules/35-calling-functions/150-calling-funcitons-expression/index.py: -------------------------------------------------------------------------------- 1 | text = "Never forget what you are, for surely the world will not" 2 | 3 | # BEGIN 4 | result = f"First: {text[0]}\nLast: {text[-1]}" 5 | print(result) 6 | # END 7 | -------------------------------------------------------------------------------- /modules/35-calling-functions/150-calling-funcitons-expression/ru/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Выведите на экран первую и последнюю буквы предложения, записанного в переменную `text`, в следующем формате: 3 | 4 |
 5 | First: N
 6 | Last: t
 7 | 
8 | 9 | Постарайтесь создать только одну переменную, в которую сразу запишется нужный текст перед печатью на экран. В этом уроке мы отрабатываем умение собирать составное выражение. 10 | -------------------------------------------------------------------------------- /modules/35-calling-functions/150-calling-funcitons-expression/ru/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Вызов функции — выражение 3 | definitions: 4 | - name: Выражение 5 | description: > 6 | последовательность действий над данными, приводящая к каком-то результату, 7 | который можно использовать. 8 | -------------------------------------------------------------------------------- /modules/35-calling-functions/150-calling-funcitons-expression/test_code.py: -------------------------------------------------------------------------------- 1 | from hexlet.test import expect_output 2 | 3 | 4 | def test(capsys): 5 | expected = "First: N\nLast: t" 6 | expect_output(capsys, expected) 7 | -------------------------------------------------------------------------------- /modules/35-calling-functions/180-variadic-parameters/Makefile: -------------------------------------------------------------------------------- 1 | test: 2 | @ test.sh 3 | -------------------------------------------------------------------------------- /modules/35-calling-functions/180-variadic-parameters/en/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Calculate the minimum number (not mentally) from 3, 10, 22, -3, 0 - and display it. Use the `min()` function, which works in the same way as `max()`. 3 | -------------------------------------------------------------------------------- /modules/35-calling-functions/180-variadic-parameters/en/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Functions With Varying Numbers of Parameters 3 | tips: [] 4 | -------------------------------------------------------------------------------- /modules/35-calling-functions/180-variadic-parameters/es/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Calcule programáticamente (no mentalmente) el número mínimo entre 3, 10, 22, -3, 0, y muéstrelo en pantalla. Utilice la función `min()`, que funciona de manera similar a `max()`. 3 | -------------------------------------------------------------------------------- /modules/35-calling-functions/180-variadic-parameters/es/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Funciones con número variable de parámetros 3 | tips: 4 | - > 5 | [Ejemplo de función con número variable de 6 | parámetros](https://docs.python.org/3/library/functions.html?highlight=pow#max) 7 | definitions: 8 | - name: Argumento por defecto 9 | description: argumento opcional de una función. 10 | -------------------------------------------------------------------------------- /modules/35-calling-functions/180-variadic-parameters/index.py: -------------------------------------------------------------------------------- 1 | # BEGIN 2 | print(min(3, -3, 10, 22, 0)) 3 | # END 4 | -------------------------------------------------------------------------------- /modules/35-calling-functions/180-variadic-parameters/ru/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Посчитайте программно (а не в голове) минимальное число среди 3, 10, 22, -3, 0 — и выведите его на экран. Воспользуйтесь функцией `min()`, которая работает аналогично `max()`. 3 | -------------------------------------------------------------------------------- /modules/35-calling-functions/180-variadic-parameters/ru/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Функции с переменным числом параметров 3 | tips: 4 | - > 5 | [Пример функции с переменным числом 6 | параметров](https://docs.python.org/3/library/functions.html?highlight=pow#max) 7 | definitions: 8 | - name: Аргумент по умолчанию 9 | description: необязательный аргумент функции. 10 | -------------------------------------------------------------------------------- /modules/35-calling-functions/180-variadic-parameters/test_code.py: -------------------------------------------------------------------------------- 1 | from hexlet.test import expect_output 2 | 3 | 4 | def test(capsys): 5 | expected = "-3" 6 | expect_output(capsys, expected) 7 | -------------------------------------------------------------------------------- /modules/35-calling-functions/270-deterministic/Makefile: -------------------------------------------------------------------------------- 1 | test: 2 | @ test.sh 3 | -------------------------------------------------------------------------------- /modules/35-calling-functions/270-deterministic/en/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Determinacy 3 | tips: 4 | - | 5 | [Pure function](https://en.wikipedia.org/wiki/Pure_function) 6 | -------------------------------------------------------------------------------- /modules/35-calling-functions/270-deterministic/es/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Determinismo 3 | tips: 4 | - | 5 | [Funciones deterministas](https://en.wikipedia.org/wiki/Pure_function) 6 | definitions: 7 | - name: Efecto secundario 8 | description: >- 9 | una acción que modifica el entorno externo (el entorno de ejecución). Por 10 | ejemplo, la impresión en pantalla o el envío de un correo electrónico. 11 | -------------------------------------------------------------------------------- /modules/35-calling-functions/270-deterministic/index.py: -------------------------------------------------------------------------------- 1 | # imports are studied on Hexlet 2 | from random import random 3 | 4 | # BEGIN 5 | print(round(random() * 10)) 6 | # END 7 | -------------------------------------------------------------------------------- /modules/35-calling-functions/270-deterministic/ru/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Детерминированность 3 | tips: 4 | - > 5 | [Детерминированные 6 | функции](https://ru.wikipedia.org/wiki/Чистота_функции#Детерминированность_функции) 7 | definitions: 8 | - name: Побочный эффект 9 | description: >- 10 | действие, которое изменяет внешнее окружение (среду выполнения). Например, 11 | вывод на экран или отправка письма. 12 | -------------------------------------------------------------------------------- /modules/35-calling-functions/270-deterministic/test_code.py: -------------------------------------------------------------------------------- 1 | from hexlet.test import expect_output 2 | 3 | 4 | def check(output): 5 | value = int(output) 6 | 7 | assert value >= 0 8 | assert value <= 10 9 | 10 | 11 | def test(capsys): 12 | expect_output(capsys, check) 13 | -------------------------------------------------------------------------------- /modules/35-calling-functions/900-stdlib/Makefile: -------------------------------------------------------------------------------- 1 | test: 2 | @ test.sh 3 | -------------------------------------------------------------------------------- /modules/35-calling-functions/900-stdlib/en/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | The `type()` function allows you to define the type of the passed argument. The type name is returned as a string. For example, calling `type(10)` will return the string `` (int, short for integer). 3 | 4 | ```python 5 | print(type('wow')) # 6 | ``` 7 | 8 | Display the type of the variable `motto` value. 9 | -------------------------------------------------------------------------------- /modules/35-calling-functions/900-stdlib/en/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Standard Library 3 | definitions: 4 | - name: Standard Library 5 | description: a set of useful features included with the programming language. 6 | -------------------------------------------------------------------------------- /modules/35-calling-functions/900-stdlib/es/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | La función `type()` permite determinar el tipo del argumento pasado. El nombre del tipo se devuelve como una cadena de texto. Por ejemplo, ejecutar `type(10)` devolverá la cadena de texto `` (int es la abreviatura de integer, que significa número entero). 3 | 4 | ```python 5 | print(type('wow')) # 6 | ``` 7 | 8 | Muestra en pantalla el tipo del valor de la variable `motto`. 9 | -------------------------------------------------------------------------------- /modules/35-calling-functions/900-stdlib/es/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Biblioteca estándar 3 | tips: 4 | - > 5 | [Referencia de funciones de 6 | Python](https://docs.python.org/3/library/index.html) 7 | - | 8 | [Cómo buscar información técnica](https://codica.la/guides/how-to-search/) 9 | definitions: 10 | - name: Biblioteca estándar 11 | description: >- 12 | conjunto de funciones útiles que se incluyen en el lenguaje de 13 | programación. 14 | -------------------------------------------------------------------------------- /modules/35-calling-functions/900-stdlib/index.py: -------------------------------------------------------------------------------- 1 | motto = "Family, Duty, Honor" 2 | 3 | # BEGIN 4 | print(type(motto)) 5 | # END 6 | -------------------------------------------------------------------------------- /modules/35-calling-functions/900-stdlib/ru/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Функция `type()` позволяет определить тип передаваемого аргумента. Название типа возвращается в виде строки. Например, вызов `type(10)` вернёт строку `` (int, это сокращение от integer — целое число). 3 | 4 | ```python 5 | print(type('wow')) # 6 | ``` 7 | 8 | Выведите на экран тип значения переменной `motto`. 9 | -------------------------------------------------------------------------------- /modules/35-calling-functions/900-stdlib/ru/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Стандартная библиотека 3 | tips: 4 | - | 5 | [Справочник функций Python](https://docs-python.ru/standart-library/) 6 | - > 7 | [Как искать техническую 8 | информацию](https://guides.hexlet.io/ru/how-to-search/) 9 | definitions: 10 | - name: Стандартная библиотека 11 | description: >- 12 | набор полезных функций, входящий в комплект поставки языка 13 | программирования. 14 | -------------------------------------------------------------------------------- /modules/35-calling-functions/900-stdlib/test_code.py: -------------------------------------------------------------------------------- 1 | from hexlet.test import expect_output 2 | 3 | 4 | def test(capsys): 5 | expected = "" 6 | expect_output(capsys, expected) 7 | -------------------------------------------------------------------------------- /modules/38-objects/100-objects/Makefile: -------------------------------------------------------------------------------- 1 | test: 2 | @ test.sh 3 | -------------------------------------------------------------------------------- /modules/38-objects/100-objects/en/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Make the string `text` lowercase and print it on the screen. An example of a method that performs this task is given in the theory. 3 | -------------------------------------------------------------------------------- /modules/38-objects/100-objects/en/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Objects 3 | -------------------------------------------------------------------------------- /modules/38-objects/100-objects/es/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Convierte la cadena `text` a minúsculas e imprímela en la pantalla. En la teoría se muestra un ejemplo de un método que realiza esta tarea. 3 | -------------------------------------------------------------------------------- /modules/38-objects/100-objects/es/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Objetos 3 | tips: 4 | - > 5 | [Métodos de 6 | cadenas](https://python.readthedocs.io/en/latest/library/stdtypes.html#string-methods) 7 | -------------------------------------------------------------------------------- /modules/38-objects/100-objects/index.py: -------------------------------------------------------------------------------- 1 | text = "a MIND needs Books as a Sword needS a WHETSTONE." 2 | 3 | # BEGIN 4 | lower_text = text.lower() 5 | print(lower_text) 6 | # END 7 | -------------------------------------------------------------------------------- /modules/38-objects/100-objects/ru/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Приведите строку `text` к нижнему регистру и напечатайте её на экран. Пример метода, выполняющего эту задачу приведен в теории. 3 | -------------------------------------------------------------------------------- /modules/38-objects/100-objects/ru/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Объекты 3 | tips: 4 | - > 5 | [Методы 6 | строк](https://python.readthedocs.io/en/latest/library/stdtypes.html#string-methods) 7 | -------------------------------------------------------------------------------- /modules/38-objects/100-objects/test_code.py: -------------------------------------------------------------------------------- 1 | from hexlet.test import expect_output 2 | 3 | 4 | def test(capsys): 5 | expected = "a mind needs books as a sword needs a whetstone." 6 | expect_output(capsys, expected) 7 | -------------------------------------------------------------------------------- /modules/38-objects/200-methods-immutability/Makefile: -------------------------------------------------------------------------------- 1 | test: 2 | @ test.sh 3 | -------------------------------------------------------------------------------- /modules/38-objects/200-methods-immutability/en/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | User input data often contains extra spaces at the end or beginning of a string. They're usually cut out using a method [.strip()](https://docs.python.org/3/library/stdtypes.html), for example, it was ``hello\n'`` and now it's ``hello'``. 3 | 4 | Update the `first_name` variable by writing the same value to it, but this time processed by the `.strip()` method. Print the result. 5 | -------------------------------------------------------------------------------- /modules/38-objects/200-methods-immutability/en/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Immutability 3 | tips: [] 4 | -------------------------------------------------------------------------------- /modules/38-objects/200-methods-immutability/es/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Los datos ingresados por los usuarios a menudo contienen espacios en blanco adicionales al principio o al final de la cadena. Por lo general, se eliminan utilizando el método [.strip()](https://docs.python.org/3/library/stdtypes.html). Por ejemplo, si teníamos: `' hello\n '`, ahora tenemos: `'hello'`. 3 | 4 | Actualiza la variable `first_name`, asignándole el mismo valor pero procesado con el método `.strip()`. Imprime en pantalla el resultado obtenido. 5 | -------------------------------------------------------------------------------- /modules/38-objects/200-methods-immutability/es/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Inmutabilidad 3 | definitions: 4 | - name: Método 5 | description: | 6 | es una función o procedimiento que pertenece a una clase u objeto. 7 | -------------------------------------------------------------------------------- /modules/38-objects/200-methods-immutability/index.py: -------------------------------------------------------------------------------- 1 | first_name = " Grigor \n" 2 | 3 | # BEGIN 4 | first_name = first_name.strip() 5 | print(first_name) 6 | # END 7 | -------------------------------------------------------------------------------- /modules/38-objects/200-methods-immutability/ru/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Данные, вводимые пользователями, часто содержат лишние пробельные символы в конце или начале строки. Обычно их вырезают с помощью метода [.strip()](https://docs.python.org/3/library/stdtypes.html), например, было: `' hello\n '`, стало: `'hello'`. 3 | 4 | Обновите переменную `first_name`, записав в неё то же самое значение, но обработанное методом `.strip()`. Распечатайте то, что получилось, на экран. 5 | -------------------------------------------------------------------------------- /modules/38-objects/200-methods-immutability/ru/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Неизменяемость 3 | definitions: 4 | - name: Метод 5 | description: | 6 | это функция или процедура, принадлежащая какому-то классу или объекту. 7 | -------------------------------------------------------------------------------- /modules/38-objects/200-methods-immutability/test_code.py: -------------------------------------------------------------------------------- 1 | from hexlet.test import expect_output 2 | 3 | 4 | def test(capsys): 5 | expected = "Grigor" 6 | expect_output(capsys, expected) 7 | -------------------------------------------------------------------------------- /modules/38-objects/300-method-expressions/Makefile: -------------------------------------------------------------------------------- 1 | test: 2 | @ test.sh 3 | -------------------------------------------------------------------------------- /modules/38-objects/300-method-expressions/en/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Methods as expressions 3 | tips: [] 4 | -------------------------------------------------------------------------------- /modules/38-objects/300-method-expressions/es/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Métodos como expresiones 3 | definitions: 4 | - name: Método 5 | description: | 6 | es una función o procedimiento que pertenece a una clase u objeto. 7 | -------------------------------------------------------------------------------- /modules/38-objects/300-method-expressions/index.py: -------------------------------------------------------------------------------- 1 | text = "Never forget what you are, for surely the world will not" 2 | 3 | # BEGIN 4 | print(f"Index Of N: {text.find('N')}\nIndex Of ,: {text.find(',')}") 5 | # END 6 | -------------------------------------------------------------------------------- /modules/38-objects/300-method-expressions/ru/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Методы как выражения 3 | definitions: 4 | - name: Метод 5 | description: | 6 | это функция или процедура, принадлежащая какому-то классу или объекту. 7 | -------------------------------------------------------------------------------- /modules/38-objects/300-method-expressions/test_code.py: -------------------------------------------------------------------------------- 1 | from hexlet.test import expect_output 2 | 3 | 4 | def test(capsys): 5 | expected = "Index Of N: 0\nIndex Of ,: 25" 6 | expect_output(capsys, expected) 7 | -------------------------------------------------------------------------------- /modules/38-objects/500-method-chain/Makefile: -------------------------------------------------------------------------------- 1 | test: 2 | @ test.sh 3 | -------------------------------------------------------------------------------- /modules/38-objects/500-method-chain/en/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Use the string cutter to get part of the sentence written in the `text` variable, from `5` to `15` characters inclusive. Process the resulting substring using the `.strip()` method and display the length of the resulting substring. Perform these operations in a chain without creating intermediate variables. 3 | -------------------------------------------------------------------------------- /modules/38-objects/500-method-chain/en/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: The call chain 3 | tips: [] 4 | -------------------------------------------------------------------------------- /modules/38-objects/500-method-chain/es/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Usando el corte de cadenas, obtén una parte de la oración almacenada en la variable `text`, desde el carácter `5` hasta el carácter `15`, inclusive. Luego, procesa la subcadena obtenida con el método `.strip()` y muestra en pantalla la longitud de la subcadena resultante. Realiza estas operaciones en cadena sin crear variables intermedias. 3 | -------------------------------------------------------------------------------- /modules/38-objects/500-method-chain/es/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Cadena de llamadas 3 | definitions: 4 | - name: Método 5 | description: | 6 | es una función o procedimiento que pertenece a una clase u objeto. 7 | -------------------------------------------------------------------------------- /modules/38-objects/500-method-chain/index.py: -------------------------------------------------------------------------------- 1 | text = "When \t\n you play a \t\n game of thrones you win or you die." 2 | 3 | # BEGIN 4 | print(len(text[4:15].strip())) 5 | # END 6 | -------------------------------------------------------------------------------- /modules/38-objects/500-method-chain/ru/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | С помощью среза строк получите часть предложения, записанного в переменную `text`, c `5` по `15` символы включительно. Полученную подстроку обработайте методом `.strip()` и выведите на экран длину итоговой подстроки. Выполните эти операции подряд в цепочке без создания промежуточных переменных. 3 | -------------------------------------------------------------------------------- /modules/38-objects/500-method-chain/ru/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Цепочка вызовов 3 | definitions: 4 | - name: Метод 5 | description: | 6 | это функция или процедура, принадлежащая какому-то классу или объекту. 7 | -------------------------------------------------------------------------------- /modules/38-objects/500-method-chain/test_code.py: -------------------------------------------------------------------------------- 1 | from hexlet.test import expect_output 2 | 3 | 4 | def test(capsys): 5 | expected = "7" 6 | expect_output(capsys, expected) 7 | -------------------------------------------------------------------------------- /modules/40-define-functions/100-define-function/Makefile: -------------------------------------------------------------------------------- 1 | test: 2 | @ test.sh 3 | -------------------------------------------------------------------------------- /modules/40-define-functions/100-define-function/en/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Implement a function named `print_motto()` that displays the phrase *Winter is coming*. 3 | 4 | ```python 5 | print_motto() # => Winter is coming 6 | ``` 7 | 8 | In tasks where you have to implement a function, you don't need to call it. Automated tests will call this function to check if it works. The example call above is shown just to give you an idea of how your function will be used. 9 | -------------------------------------------------------------------------------- /modules/40-define-functions/100-define-function/en/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Creating (defining) functions 3 | tips: 4 | - > 5 | [Naming in 6 | programming](https://hexlet.io/blog/posts/code-complete-naming-in-programming) 7 | -------------------------------------------------------------------------------- /modules/40-define-functions/100-define-function/es/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Creación (definición) de funciones 3 | tips: 4 | - | 5 | [Naming en programación](https://codica.la/blog/naming-in-programming) 6 | -------------------------------------------------------------------------------- /modules/40-define-functions/100-define-function/index.py: -------------------------------------------------------------------------------- 1 | def print_motto(): 2 | print("Winter is coming") 3 | -------------------------------------------------------------------------------- /modules/40-define-functions/100-define-function/ru/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Реализуйте функцию с именем `print_motto()`, которая выведет на экран фразу *Winter is coming*. 3 | 4 | ```python 5 | print_motto() # => Winter is coming 6 | ``` 7 | 8 | В задачах, в которых нужно реализовать функцию, эту функцию вызывать не нужно. Вызывать функцию будут автоматизированные тесты, которые проверяют его работоспособность. Пример с вызовом выше показан только для того, чтобы вы понимали, как ваша функция будет использоваться. 9 | -------------------------------------------------------------------------------- /modules/40-define-functions/100-define-function/ru/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Создание (определение) функций 3 | tips: 4 | - > 5 | [Именование в 6 | программировании](https://ru.hexlet.io/blog/posts/naming-in-programming?utm_source=code-basics&utm_medium=referral&utm_campaign=blog&utm_content=lesson) 7 | -------------------------------------------------------------------------------- /modules/40-define-functions/100-define-function/test_code.py: -------------------------------------------------------------------------------- 1 | import index 2 | from hexlet.test import expect_output 3 | 4 | 5 | def test(capsys): 6 | index.print_motto() 7 | expected = "Winter is coming" 8 | expect_output(capsys, expected) 9 | -------------------------------------------------------------------------------- /modules/40-define-functions/200-return/Makefile: -------------------------------------------------------------------------------- 1 | test: 2 | @ test.sh 3 | -------------------------------------------------------------------------------- /modules/40-define-functions/200-return/en/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Implement the `say_hurray_three_times()` function, which returns the string 'hurray! hurray! hurray!'. 3 | 4 | ```python 5 | hurray = say_hurray_three_times() 6 | print(hurray) # => hurray! hurray! hurray! 7 | ``` 8 | -------------------------------------------------------------------------------- /modules/40-define-functions/200-return/en/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Return values 3 | -------------------------------------------------------------------------------- /modules/40-define-functions/200-return/es/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Implementa la función `say_hurray_three_times()`, que devuelve la cadena 'hurray! hurray! hurray!'. 3 | 4 | ```python 5 | hurray = say_hurray_three_times() 6 | print(hurray) # => hurray! hurray! hurray! 7 | ``` 8 | -------------------------------------------------------------------------------- /modules/40-define-functions/200-return/es/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Devolución de valores 3 | tips: 4 | - | 5 | [return](https://www.w3schools.com/python/ref_keyword_return.asp) 6 | -------------------------------------------------------------------------------- /modules/40-define-functions/200-return/index.py: -------------------------------------------------------------------------------- 1 | # BEGIN 2 | def say_hurray_three_times(): 3 | word = "hurray!" 4 | return f"{word} {word} {word}" 5 | 6 | 7 | # END 8 | -------------------------------------------------------------------------------- /modules/40-define-functions/200-return/ru/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Реализуйте функцию `say_hurray_three_times()`, которая возвращает строку 'hurray! hurray! hurray!'. 3 | 4 | ```python 5 | hurray = say_hurray_three_times() 6 | print(hurray) # => hurray! hurray! hurray! 7 | ``` 8 | -------------------------------------------------------------------------------- /modules/40-define-functions/200-return/ru/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Возврат значений 3 | tips: 4 | - | 5 | [return](https://www.w3schools.com/python/ref_keyword_return.asp) 6 | -------------------------------------------------------------------------------- /modules/40-define-functions/200-return/test_code.py: -------------------------------------------------------------------------------- 1 | import index 2 | 3 | 4 | def test(): 5 | expected = "hurray! hurray! hurray!" 6 | assert index.say_hurray_three_times() == expected 7 | -------------------------------------------------------------------------------- /modules/40-define-functions/300-parameters/Makefile: -------------------------------------------------------------------------------- 1 | test: 2 | @ test.sh 3 | -------------------------------------------------------------------------------- /modules/40-define-functions/300-parameters/en/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Function Parameters 3 | -------------------------------------------------------------------------------- /modules/40-define-functions/300-parameters/es/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Parámetros de las funciones 3 | tips: 4 | - > 5 | [Parámetros de la 6 | función](https://es.wikipedia.org/wiki/Argumento_(informática)) 7 | -------------------------------------------------------------------------------- /modules/40-define-functions/300-parameters/index.py: -------------------------------------------------------------------------------- 1 | def truncate(text, length): 2 | # BEGIN 3 | result = f"{text[0:length]}..." 4 | return result 5 | # END 6 | -------------------------------------------------------------------------------- /modules/40-define-functions/300-parameters/ru/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Параметры функций 3 | tips: 4 | - > 5 | [Параметры 6 | функции](https://ru.wikipedia.org/wiki/Параметр_(программирование)) 7 | -------------------------------------------------------------------------------- /modules/40-define-functions/300-parameters/test_code.py: -------------------------------------------------------------------------------- 1 | import index 2 | 3 | 4 | def test(): 5 | assert index.truncate("hexlet", 2) == "he..." 6 | assert index.truncate("it works!", 4) == "it w..." 7 | -------------------------------------------------------------------------------- /modules/40-define-functions/400-default-parameters/Makefile: -------------------------------------------------------------------------------- 1 | test: 2 | @ test.sh 3 | -------------------------------------------------------------------------------- /modules/40-define-functions/400-default-parameters/en/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Optional function parameters 3 | -------------------------------------------------------------------------------- /modules/40-define-functions/400-default-parameters/es/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Parámetros opcionales de las funciones 3 | tips: 4 | - > 5 | [Parámetros por 6 | defecto](https://developer.mozilla.org/es/docs/Web/JavaScript/Reference/Functions/Default_parameters) 7 | definitions: 8 | - name: Parámetro por defecto 9 | description: parámetro opcional de una función 10 | -------------------------------------------------------------------------------- /modules/40-define-functions/400-default-parameters/index.py: -------------------------------------------------------------------------------- 1 | def get_hidden_card(card_number, stars_count=4): 2 | visible_digits_line = card_number[-4:] 3 | return f"{'*' * stars_count}{visible_digits_line}" 4 | -------------------------------------------------------------------------------- /modules/40-define-functions/400-default-parameters/ru/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Необязательные параметры функций 3 | tips: 4 | - > 5 | [Параметры по 6 | умолчанию](https://developer.mozilla.org/ru/docs/Web/JavaScript/Reference/Functions/Default_parameters) 7 | definitions: 8 | - name: Параметр по умолчанию 9 | description: необязательный параметр функции 10 | -------------------------------------------------------------------------------- /modules/40-define-functions/400-default-parameters/test_code.py: -------------------------------------------------------------------------------- 1 | import index 2 | 3 | 4 | def test(): 5 | assert index.get_hidden_card("1234123412341234") == "****1234" 6 | assert index.get_hidden_card("1234123412344321") == "****4321" 7 | assert index.get_hidden_card("1234123412344321", 3) == "***4321" 8 | -------------------------------------------------------------------------------- /modules/40-define-functions/500-named-arguments/Makefile: -------------------------------------------------------------------------------- 1 | test: 2 | @ test.sh 3 | -------------------------------------------------------------------------------- /modules/40-define-functions/500-named-arguments/en/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Named arguments 3 | -------------------------------------------------------------------------------- /modules/40-define-functions/500-named-arguments/es/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Argumentos Nombrados 3 | -------------------------------------------------------------------------------- /modules/40-define-functions/500-named-arguments/index.py: -------------------------------------------------------------------------------- 1 | def trim_and_repeat(text, offset=0, repetitions=1): 2 | return text[offset:] * repetitions 3 | -------------------------------------------------------------------------------- /modules/40-define-functions/500-named-arguments/ru/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Именованные аргументы 3 | -------------------------------------------------------------------------------- /modules/40-define-functions/500-named-arguments/test_code.py: -------------------------------------------------------------------------------- 1 | import index 2 | 3 | 4 | def test(): 5 | assert index.trim_and_repeat("python") == "python" 6 | assert index.trim_and_repeat("python", offset=4) == "on" 7 | assert index.trim_and_repeat("python", repetitions=2) == "pythonpython" 8 | assert index.trim_and_repeat("python", offset=4, repetitions=2) == "onon" 9 | -------------------------------------------------------------------------------- /modules/40-define-functions/600-type-annotations/Makefile: -------------------------------------------------------------------------------- 1 | test: 2 | @ test.sh 3 | -------------------------------------------------------------------------------- /modules/40-define-functions/600-type-annotations/en/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Implement a function, `word_multiply()`. It should accept two parameters: 3 | 4 | * A word 5 | * A number representing how many times to repeat the word 6 | 7 | ```python 8 | text = 'python' 9 | print(word_multiply(text, 2)) # => pythonpython 10 | print(word_multiply(text, 0)) # => 11 | ``` 12 | 13 | Specify type annotations when declaring a function. 14 | -------------------------------------------------------------------------------- /modules/40-define-functions/600-type-annotations/en/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Type Annotations 3 | -------------------------------------------------------------------------------- /modules/40-define-functions/600-type-annotations/es/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Implementa la función `word_multiply()`. Debe aceptar dos parámetros: 3 | 4 | * Una cadena de texto 5 | * Un número que indica cuántas veces se debe repetir la cadena 6 | 7 | ```python 8 | text = 'python' 9 | print(word_multiply(text, 2)) # => pythonpython 10 | print(word_multiply(text, 0)) # => 11 | ``` 12 | 13 | Especifica las anotaciones de tipos al declarar la función. 14 | -------------------------------------------------------------------------------- /modules/40-define-functions/600-type-annotations/es/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Anotaciones de tipos 3 | -------------------------------------------------------------------------------- /modules/40-define-functions/600-type-annotations/index.py: -------------------------------------------------------------------------------- 1 | def word_multiply(text: str, repetitions: int) -> str: 2 | return text * repetitions 3 | -------------------------------------------------------------------------------- /modules/40-define-functions/600-type-annotations/ru/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Реализуйте функцию `word_multiply()`. Она должна принимать два параметра: 3 | 4 | * Строку 5 | * Число, которое обозначает, сколько раз нужно повторить строку 6 | 7 | ```python 8 | text = 'python' 9 | print(word_multiply(text, 2)) # => pythonpython 10 | print(word_multiply(text, 0)) # => 11 | ``` 12 | 13 | Укажите аннотации типов при объявлении функции. 14 | -------------------------------------------------------------------------------- /modules/40-define-functions/600-type-annotations/ru/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Аннотации типов 3 | -------------------------------------------------------------------------------- /modules/40-define-functions/test_code.py: -------------------------------------------------------------------------------- 1 | from hexlet.test import expect_output 2 | 3 | 4 | def test(capsys): 5 | expected = "7" 6 | expect_output(capsys, expected) 7 | -------------------------------------------------------------------------------- /modules/45-logic/10-bool-type/Makefile: -------------------------------------------------------------------------------- 1 | test: 2 | @ test.sh 3 | -------------------------------------------------------------------------------- /modules/45-logic/10-bool-type/en/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Write a function `is_pensioner()` that takes someone's age as a single argument and checks whether that person is at retirement age. For the purposes of this exercise, retirement age is considered to be 60 years or over. 3 | 4 | Call examples: 5 | 6 | ```python 7 | is_pensioner(75) # True 8 | is_pensioner(18) # False 9 | ``` 10 | -------------------------------------------------------------------------------- /modules/45-logic/10-bool-type/en/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Logic type 3 | definitions: 4 | - name: “Logic type (bool)” 5 | description: 'a data type with two possible values: `True` or `False`' 6 | -------------------------------------------------------------------------------- /modules/45-logic/10-bool-type/es/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Escriba una función `is_pensioner()` que tome la edad como único argumento y verifique si esa edad corresponde a la jubilación. Se considera jubilación a partir de los 60 años. 3 | 4 | Ejemplos de llamadas: 5 | 6 | ```python 7 | is_pensioner(75) # True 8 | is_pensioner(18) # False 9 | ``` 10 | -------------------------------------------------------------------------------- /modules/45-logic/10-bool-type/es/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Tipo lógico 3 | tips: 4 | - > 5 | [Booleanos en 6 | Python](https://docs.python.org/3/library/stdtypes.html#boolean-values) 7 | definitions: 8 | - name: Tipo lógico (bool) 9 | description: >- 10 | un tipo de dato con dos posibles valores: `True` (verdadero) y `False` 11 | (falso). 12 | -------------------------------------------------------------------------------- /modules/45-logic/10-bool-type/index.py: -------------------------------------------------------------------------------- 1 | def is_pensioner(age): 2 | return age >= 60 3 | -------------------------------------------------------------------------------- /modules/45-logic/10-bool-type/ru/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Напишите функцию `is_pensioner()`, которая принимает возраст в качестве единственного аргумента и проверяет, является ли этот возраст пенсионным. Пенсионным считается возраст 60 лет и больше. 3 | 4 | Примеры вызова: 5 | 6 | ```python 7 | is_pensioner(75) # True 8 | is_pensioner(18) # False 9 | ``` 10 | -------------------------------------------------------------------------------- /modules/45-logic/10-bool-type/ru/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Логический тип 3 | tips: 4 | - > 5 | [Boolean в 6 | Python](https://docs.python.org/3/library/stdtypes.html#boolean-values) 7 | definitions: 8 | - name: Логический тип (bool) 9 | description: >- 10 | тип данных с двумя возможными значениями: `True` (истина) и `False` 11 | (ложь). 12 | -------------------------------------------------------------------------------- /modules/45-logic/10-bool-type/test_code.py: -------------------------------------------------------------------------------- 1 | import index 2 | 3 | 4 | def test1(): 5 | assert not index.is_pensioner(23) 6 | assert index.is_pensioner(70) 7 | assert index.is_pensioner(60) 8 | assert not index.is_pensioner(59) 9 | -------------------------------------------------------------------------------- /modules/45-logic/15-predicates/Makefile: -------------------------------------------------------------------------------- 1 | test: 2 | @ test.sh 3 | -------------------------------------------------------------------------------- /modules/45-logic/15-predicates/en/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Write a function `is_mister()` that accepts a string and checks if it is the word `'Mister'`. 3 | 4 | ```python 5 | is_mister('Mister') # True 6 | is_mister('Missis') # False 7 | ``` 8 | -------------------------------------------------------------------------------- /modules/45-logic/15-predicates/en/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Predicates 3 | tips: 4 | - > 5 | [Naming in 6 | Programming](https://hexlet.io/blog/posts/code-complete-naming-in-programming) 7 | definitions: 8 | - name: Predicate 9 | description: выражение, отвечающее на вопрос «да» или «нет» с помощью типа bool. 10 | -------------------------------------------------------------------------------- /modules/45-logic/15-predicates/es/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Escriba la función `is_mister()`, que toma una cadena y verifica si es la palabra `'Mister'`. 3 | 4 | ```python 5 | is_mister('Mister') # True 6 | is_mister('Missis') # False 7 | ``` 8 | -------------------------------------------------------------------------------- /modules/45-logic/15-predicates/es/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Predicados 3 | tips: 4 | - | 5 | [Naming in Programming](https://codica.la/blog/naming-in-programming) 6 | definitions: 7 | - name: Predicado 8 | description: >- 9 | una expresión que responde a una pregunta afirmativa "sí" o "no" 10 | utilizando el tipo bool. 11 | -------------------------------------------------------------------------------- /modules/45-logic/15-predicates/index.py: -------------------------------------------------------------------------------- 1 | def is_mister(string): 2 | return string == "Mister" 3 | -------------------------------------------------------------------------------- /modules/45-logic/15-predicates/ru/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Напишите функцию `is_mister()`, которая принимает строку и проверяет, является ли она словом `'Mister'`. 3 | 4 | ```python 5 | is_mister('Mister') # True 6 | is_mister('Missis') # False 7 | ``` 8 | -------------------------------------------------------------------------------- /modules/45-logic/15-predicates/ru/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Предикаты 3 | tips: 4 | - > 5 | [Именование в 6 | программировании](https://ru.hexlet.io/blog/posts/naming-in-programming?utm_source=code-basics&utm_medium=referral&utm_campaign=blog&utm_content=lesson) 7 | definitions: 8 | - name: Предикат 9 | description: выражение, отвечающее на вопрос «да» или «нет» с помощью типа bool. 10 | -------------------------------------------------------------------------------- /modules/45-logic/15-predicates/test_code.py: -------------------------------------------------------------------------------- 1 | import index 2 | 3 | 4 | def test1(): 5 | assert not index.is_mister("8234782") 6 | assert not index.is_mister("Joker") 7 | assert index.is_mister("Mister") 8 | -------------------------------------------------------------------------------- /modules/45-logic/20-logic-combine-expressions/Makefile: -------------------------------------------------------------------------------- 1 | test: 2 | @ test.sh 3 | -------------------------------------------------------------------------------- /modules/45-logic/20-logic-combine-expressions/en/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Implement a function called `is_international_phone()` function that checks the format of a given phone number. If the phone number starts with *+*, then it's in the international format. 3 | 4 | ```python 5 | is_international_phone('89602223423') # False 6 | is_international_phone('+79602223423') # True 7 | ``` 8 | -------------------------------------------------------------------------------- /modules/45-logic/20-logic-combine-expressions/en/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Combining Operations and Functions 3 | tips: [] 4 | -------------------------------------------------------------------------------- /modules/45-logic/20-logic-combine-expressions/es/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Implementa la función `is_international_phone()`, que verifica el formato de un número de teléfono especificado. Si el teléfono comienza con un `+`, significa que está en formato internacional. 3 | 4 | ```python 5 | is_international_phone('89602223423') # False 6 | is_international_phone('+79602223423') # True 7 | ``` 8 | -------------------------------------------------------------------------------- /modules/45-logic/20-logic-combine-expressions/es/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Combinación de operaciones y funciones 3 | tips: 4 | - | 5 | [Expresión](https://es.wikipedia.org/wiki/Expresión_(informática)) 6 | definitions: 7 | - name: Expresión 8 | description: > 9 | una secuencia de acciones sobre datos que produce un resultado que se 10 | puede utilizar. 11 | -------------------------------------------------------------------------------- /modules/45-logic/20-logic-combine-expressions/index.py: -------------------------------------------------------------------------------- 1 | def is_international_phone(phone): 2 | return phone[0] == "+" 3 | -------------------------------------------------------------------------------- /modules/45-logic/20-logic-combine-expressions/ru/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Реализуйте функцию `is_international_phone()`, которая принимает на вход строку - номер телефона и проверяет его формат. Если телефон начинается с *+*, значит это международный формат. 3 | 4 | ```python 5 | is_international_phone('89602223423') # False 6 | is_international_phone('+79602223423') # True 7 | ``` 8 | -------------------------------------------------------------------------------- /modules/45-logic/20-logic-combine-expressions/ru/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Комбинирование операций и функций 3 | tips: 4 | - | 5 | [Выражение](https://ru.wikipedia.org/wiki/Выражение_(информатика)) 6 | definitions: 7 | - name: Выражение 8 | description: > 9 | последовательность действий над данными, приводящая к каком-то результату, 10 | который можно использовать. 11 | -------------------------------------------------------------------------------- /modules/45-logic/20-logic-combine-expressions/test_code.py: -------------------------------------------------------------------------------- 1 | import index 2 | 3 | 4 | def test1(): 5 | assert not index.is_international_phone("89602223423") 6 | assert index.is_international_phone("+79602223423") 7 | -------------------------------------------------------------------------------- /modules/45-logic/25-logical-operators/Makefile: -------------------------------------------------------------------------------- 1 | test: 2 | @ test.sh 3 | -------------------------------------------------------------------------------- /modules/45-logic/25-logical-operators/assets/lannisters.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hexlet-basics/exercises-python/d551f48fe1a363482a9a5e0019190fffbe36a8bd/modules/45-logic/25-logical-operators/assets/lannisters.jpg -------------------------------------------------------------------------------- /modules/45-logic/25-logical-operators/index.py: -------------------------------------------------------------------------------- 1 | def is_leap_year(year): 2 | return year % 400 == 0 or (year % 4 == 0 and year % 100 != 0) 3 | -------------------------------------------------------------------------------- /modules/45-logic/25-logical-operators/test_code.py: -------------------------------------------------------------------------------- 1 | import index 2 | 3 | 4 | def test1(): 5 | assert index.is_leap_year(2016) 6 | assert index.is_leap_year(2000) 7 | assert not index.is_leap_year(2017) 8 | assert not index.is_leap_year(2018) 9 | assert not index.is_leap_year(1900) 10 | -------------------------------------------------------------------------------- /modules/45-logic/28-logical-negation/Makefile: -------------------------------------------------------------------------------- 1 | test: 2 | @ test.sh 3 | -------------------------------------------------------------------------------- /modules/45-logic/28-logical-negation/en/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Negation 3 | tips: 4 | - | 5 | [De Morgan's laws](https://en.wikipedia.org/wiki/De_Morgan%27s_laws) 6 | -------------------------------------------------------------------------------- /modules/45-logic/28-logical-negation/es/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Negación 3 | tips: 4 | - | 5 | [Leyes de De Morgan](https://es.wikipedia.org/wiki/Leyes_de_De_Morgan) 6 | definitions: 7 | - name: Negación 8 | description: | 9 | operación lógica que cambia el valor lógico al opuesto. 10 | -------------------------------------------------------------------------------- /modules/45-logic/28-logical-negation/index.py: -------------------------------------------------------------------------------- 1 | def is_palindrome(word): 2 | lower_word = word.lower() 3 | return lower_word == lower_word[::-1] 4 | 5 | 6 | def is_not_palindrome(word): 7 | return not is_palindrome(word) 8 | -------------------------------------------------------------------------------- /modules/45-logic/28-logical-negation/ru/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Отрицание 3 | tips: 4 | - | 5 | [Законы Де Моргана](https://ru.wikipedia.org/wiki/Законы_де_Моргана) 6 | definitions: 7 | - name: Отрицание 8 | description: > 9 | логическая операция, которая меняет логическое значение на 10 | противоположное. 11 | -------------------------------------------------------------------------------- /modules/45-logic/28-logical-negation/test_code.py: -------------------------------------------------------------------------------- 1 | import index 2 | 3 | 4 | def test1(): 5 | assert not index.is_not_palindrome("wow") 6 | assert index.is_not_palindrome("hexlet") 7 | assert not index.is_not_palindrome("asdffdsa") 8 | assert not index.is_not_palindrome("Wow") 9 | assert index.is_not_palindrome("CodeBasics") 10 | -------------------------------------------------------------------------------- /modules/45-logic/90-logical-expressions/Makefile: -------------------------------------------------------------------------------- 1 | test: 2 | @ test.sh 3 | -------------------------------------------------------------------------------- /modules/45-logic/90-logical-expressions/en/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: The result of logical expressions 3 | -------------------------------------------------------------------------------- /modules/45-logic/90-logical-expressions/es/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Resultados de expresiones lógicas 3 | tips: 4 | - | 5 | [Booleano](https://es.wikipedia.org/wiki/Tipo_de_dato_l%C3%B3gico) 6 | -------------------------------------------------------------------------------- /modules/45-logic/90-logical-expressions/index.py: -------------------------------------------------------------------------------- 1 | def string_or_not(value): 2 | return isinstance(value, str) and "yes" or "no" 3 | -------------------------------------------------------------------------------- /modules/45-logic/90-logical-expressions/ru/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Результат логических выражений 3 | tips: 4 | - | 5 | [Boolean](https://ru.wikipedia.org/wiki/Логический_тип) 6 | -------------------------------------------------------------------------------- /modules/45-logic/90-logical-expressions/test_code.py: -------------------------------------------------------------------------------- 1 | import index 2 | 3 | 4 | def test1(): 5 | assert index.string_or_not("Hexlet") == "yes" 6 | assert index.string_or_not(10) == "no" 7 | assert index.string_or_not("") == "yes" 8 | assert index.string_or_not(False) == "no" 9 | assert index.string_or_not(True) == "no" 10 | -------------------------------------------------------------------------------- /modules/45-logic/description.en.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | name: Logic 4 | description: | 5 | Logical expressions allow you to answer questions that arise while the program is running. Is the user authenticated? Is the subscription paid for? Is it a leap year? In this module, we will study functions-predicates - those that ask a question and answer it - true or false. We will practice writing such functions and move on to more complex logical expressions. 6 | -------------------------------------------------------------------------------- /modules/45-logic/description.es.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | name: Lógica 4 | description: | 5 | Las expresiones lógicas permiten responder preguntas que surgen durante la ejecución del programa. ¿Está autenticado el usuario? ¿Se ha pagado la suscripción? ¿Es un año bisiesto? En este módulo, aprenderemos sobre las funciones booleanas, que plantean una pregunta y responden si es verdadera o falsa. Practicaremos la escritura de estas funciones y avanzaremos hacia expresiones lógicas más complejas. 6 | -------------------------------------------------------------------------------- /modules/45-logic/description.ru.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | name: Логика 4 | description: | 5 | Логические выражения позволяют отвечать на вопросы, которые возникают во время работы программы. Пользователь аутентифицирован? Подписка оплачена? Год високосный? В этом модуле изучаем функции-предикаты – те, которые задают вопрос и отвечают на него – правда это или ложь. Попрактикуемся в написании таких функций и перейдем к более сложным логическим выражениям. 6 | -------------------------------------------------------------------------------- /modules/48-conditionals/30-if/Makefile: -------------------------------------------------------------------------------- 1 | test: 2 | @ test.sh 3 | -------------------------------------------------------------------------------- /modules/48-conditionals/30-if/en/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Implement a function called `guess_number()` that takes a number and checks if the number is equal to a given number (let's say 42). If it's equal, the function should return the string `'You win!'`, otherwise it should return the string `'Try again!'`. 3 | 4 | ```python 5 | guess_number(42) # You win! 6 | guess_number(61) # Try again! 7 | ``` 8 | -------------------------------------------------------------------------------- /modules/48-conditionals/30-if/en/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Conditional Constructions (if) 3 | tips: [] 4 | definitions: 5 | - name: Conditional Design. 6 | description: >- 7 | the way to set a condition for code execution. For example, `if x > 10: . 8 | ` 9 | -------------------------------------------------------------------------------- /modules/48-conditionals/30-if/es/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Implementa la función `guess_number()`, que toma un número y verifica si es igual al número dado (supongamos que es 42). Si es igual, la función debe devolver la cadena `'You win!'`, de lo contrario, debe devolver la cadena `'Try again!'`. 3 | 4 | ```python 5 | guess_number(42) # You win! 6 | guess_number(61) # Try again! 7 | ``` 8 | -------------------------------------------------------------------------------- /modules/48-conditionals/30-if/es/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Estructura condicional (if) 3 | tips: [] 4 | definitions: 5 | - name: Estructura condicional 6 | description: >- 7 | forma de establecer una condición para ejecutar código. Por ejemplo, `if x 8 | > 10: ... ` 9 | -------------------------------------------------------------------------------- /modules/48-conditionals/30-if/index.py: -------------------------------------------------------------------------------- 1 | def guess_number(guess): 2 | if guess == 42: 3 | return "You win!" 4 | return "Try again!" 5 | -------------------------------------------------------------------------------- /modules/48-conditionals/30-if/ru/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Реализуйте функцию `guess_number()`, которая принимает число и проверяет, равно ли число заданному (пусть это будет 42). Если равно, то функция должна вернуть строку `'You win!'`, в противном случае нужно вернуть строку `'Try again!'`. 3 | 4 | ```python 5 | guess_number(42) # You win! 6 | guess_number(61) # Try again! 7 | ``` 8 | -------------------------------------------------------------------------------- /modules/48-conditionals/30-if/ru/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Условная конструкция (if) 3 | tips: [] 4 | definitions: 5 | - name: Условная конструкция 6 | description: 'способ задать условие для выполнения кода. Например, `if x > 10: ... `' 7 | -------------------------------------------------------------------------------- /modules/48-conditionals/30-if/test_code.py: -------------------------------------------------------------------------------- 1 | import index 2 | 3 | 4 | def test1(): 5 | assert index.guess_number(100500) == "Try again!" 6 | assert index.guess_number(42) == "You win!" 7 | -------------------------------------------------------------------------------- /modules/48-conditionals/40-if-else/Makefile: -------------------------------------------------------------------------------- 1 | test: 2 | @ test.sh 3 | -------------------------------------------------------------------------------- /modules/48-conditionals/40-if-else/en/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: else 3 | tips: [] 4 | definitions: 5 | - name: else 6 | description: >- 7 | a way to specify the block of code that'll be executed if an `if` 8 | condition is not satisfied. 9 | -------------------------------------------------------------------------------- /modules/48-conditionals/40-if-else/es/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Estructura condicional else 3 | tips: [] 4 | definitions: 5 | - name: else 6 | description: >- 7 | forma de especificar un bloque de código que se ejecutará si la condición 8 | del `if` no se cumple. 9 | -------------------------------------------------------------------------------- /modules/48-conditionals/40-if-else/index.py: -------------------------------------------------------------------------------- 1 | def normalize_url(url): 2 | prefix = "https://" 3 | if url[:8] == prefix: 4 | return url 5 | else: 6 | if url[:7] == "http://": 7 | return prefix + url[7:] 8 | else: 9 | return prefix + url 10 | -------------------------------------------------------------------------------- /modules/48-conditionals/40-if-else/ru/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Условная конструкция else 3 | tips: [] 4 | definitions: 5 | - name: else 6 | description: >- 7 | способ задать блок кода, который будет выполнен, если условие с `if` не 8 | удовлетворено. 9 | -------------------------------------------------------------------------------- /modules/48-conditionals/50-else-if/Makefile: -------------------------------------------------------------------------------- 1 | test: 2 | @ test.sh 3 | -------------------------------------------------------------------------------- /modules/48-conditionals/50-else-if/en/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: The construct else + if = elif 3 | tips: [] 4 | definitions: 5 | - name: else + if = elif 6 | description: a way of setting several alternative conditions. 7 | -------------------------------------------------------------------------------- /modules/48-conditionals/50-else-if/es/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Construcción else + if = elif 3 | tips: [] 4 | definitions: 5 | - name: Condicionales else + if = elif 6 | description: Un recurso para especificar condiciones alternativas, según sea el caso 7 | -------------------------------------------------------------------------------- /modules/48-conditionals/50-else-if/index.py: -------------------------------------------------------------------------------- 1 | def who_is_this_house_to_starks(house_name): 2 | if house_name == "Karstark" or house_name == "Tully": 3 | return "friend" 4 | elif house_name == "Lannister" or house_name == "Frey": 5 | return "enemy" 6 | return "neutral" 7 | -------------------------------------------------------------------------------- /modules/48-conditionals/50-else-if/ru/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Конструкция else + if = elif 3 | tips: [] 4 | definitions: 5 | - name: else + if = elif 6 | description: способ задать несколько альтернативных условий. 7 | -------------------------------------------------------------------------------- /modules/48-conditionals/50-else-if/test_code.py: -------------------------------------------------------------------------------- 1 | import index 2 | 3 | 4 | def test1(): 5 | assert index.who_is_this_house_to_starks("Tully") == "friend" 6 | assert index.who_is_this_house_to_starks("Karstark") == "friend" 7 | assert index.who_is_this_house_to_starks("Lannister") == "enemy" 8 | assert index.who_is_this_house_to_starks("Martell") == "neutral" 9 | assert index.who_is_this_house_to_starks("undefined") == "neutral" 10 | -------------------------------------------------------------------------------- /modules/48-conditionals/60-ternary-operator/Makefile: -------------------------------------------------------------------------------- 1 | test: 2 | @ test.sh 3 | -------------------------------------------------------------------------------- /modules/48-conditionals/60-ternary-operator/en/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Implement a function `flip_flop()` that takes a string as input and, if that string is `'flip'`, returns the string `'flop'`. Otherwise, the function should return `'flip'`. 3 | 4 | Examples of calls: 5 | 6 | ```python 7 | print(flip_flop('flip')) # => 'flop' 8 | print(flip_flop('flop')) # => 'flip' 9 | ``` 10 | 11 | Try writing two versions of the function: with the usual if-else, and with the ternary operator. 12 | -------------------------------------------------------------------------------- /modules/48-conditionals/60-ternary-operator/en/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Ternary operator 3 | tips: [] 4 | definitions: 5 | - name: Ternary operator 6 | description: > 7 | a way to turn a simple conditional instruction into an expression, such as 8 | `number if number >= 0 else -number`. 9 | -------------------------------------------------------------------------------- /modules/48-conditionals/60-ternary-operator/es/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Implemente la función `flip_flop()`, que recibe una cadena como entrada y, si esa cadena es igual a `'flip'`, devuelve la cadena `'flop'`. De lo contrario, la función debe devolver `'flip'`. 3 | 4 | Ejemplos de llamadas: 5 | 6 | ```python 7 | print(flip_flop('flip')) # => 'flop' 8 | print(flip_flop('flop')) # => 'flip' 9 | ``` 10 | 11 | Intente escribir dos versiones de la función: una con un if-else normal y otra con un operador ternario. 12 | -------------------------------------------------------------------------------- /modules/48-conditionals/60-ternary-operator/es/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Operador ternario 3 | tips: [] 4 | definitions: 5 | - name: Operador ternario 6 | description: > 7 | una forma de convertir una instrucción condicional simple en una 8 | expresión, por ejemplo, `number if number >= 0 else -number`. 9 | -------------------------------------------------------------------------------- /modules/48-conditionals/60-ternary-operator/index.py: -------------------------------------------------------------------------------- 1 | def flip_flop(arg): 2 | return "flop" if arg == "flip" else "flip" 3 | -------------------------------------------------------------------------------- /modules/48-conditionals/60-ternary-operator/ru/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Реализуйте функцию `flip_flop()`, которая принимает на вход строку и, если эта строка равна `'flip'`, возвращает строку `'flop'`. В противном случае функция должна вернуть `'flip'`. 3 | 4 | Примеры вызова: 5 | 6 | ```python 7 | print(flip_flop('flip')) # => 'flop' 8 | print(flip_flop('flop')) # => 'flip' 9 | ``` 10 | 11 | Попробуйте написать два варианта функции: с обычным if-else, и с тернарным оператором. 12 | -------------------------------------------------------------------------------- /modules/48-conditionals/60-ternary-operator/ru/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Тернарный оператор 3 | tips: [] 4 | definitions: 5 | - name: Тернарный оператор 6 | description: > 7 | способ превратить простую условную инструкцию в выражение, например, 8 | `number if number >= 0 else -number`. 9 | -------------------------------------------------------------------------------- /modules/48-conditionals/60-ternary-operator/test_code.py: -------------------------------------------------------------------------------- 1 | import index 2 | 3 | 4 | def test1(): 5 | assert index.flip_flop("flip") == "flop" 6 | assert index.flip_flop("flop") == "flip" 7 | -------------------------------------------------------------------------------- /modules/48-conditionals/65-match/Makefile: -------------------------------------------------------------------------------- 1 | test: 2 | @ test.sh 3 | -------------------------------------------------------------------------------- /modules/48-conditionals/65-match/en/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Match Operator 3 | tips: 4 | - > 5 | [Match](https://docs.python.org/3/reference/compound_stmts.html#the-match-statement) 6 | definitions: [] 7 | -------------------------------------------------------------------------------- /modules/48-conditionals/65-match/es/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Operador Match 3 | tips: 4 | - > 5 | [Match](https://docs.python.org/3/reference/compound_stmts.html#the-match-statement) 6 | definitions: [] 7 | -------------------------------------------------------------------------------- /modules/48-conditionals/65-match/index.py: -------------------------------------------------------------------------------- 1 | def get_number_explanation(number): 2 | match number: 3 | case 666: 4 | return "devil number" 5 | case 7: 6 | return "prime number" 7 | case 42: 8 | return "answer for everything" 9 | case _: 10 | return "just a number" 11 | -------------------------------------------------------------------------------- /modules/48-conditionals/65-match/ru/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Оператор Match 3 | tips: 4 | - > 5 | [Match](https://docs.python.org/3/reference/compound_stmts.html#the-match-statement) 6 | definitions: [] 7 | -------------------------------------------------------------------------------- /modules/48-conditionals/65-match/test_code.py: -------------------------------------------------------------------------------- 1 | import index 2 | 3 | 4 | def test1(): 5 | assert index.get_number_explanation(0) == "just a number" 6 | assert index.get_number_explanation(666) == "devil number" 7 | assert index.get_number_explanation(42) == "answer for everything" 8 | assert index.get_number_explanation(7) == "prime number" 9 | -------------------------------------------------------------------------------- /modules/48-conditionals/description.en.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | name: Conditionals 4 | description: | 5 | The job of predicate functions is to get the answer to a question. However, this usually isn't enough; you often need to perform a certain action depending on the answer. If and if-else are Python constructions that allow programmers to choose the desired behavior of the program depending on different conditions, often skipping some instructions and executing others. We'll analyse them in practice in this module. 6 | -------------------------------------------------------------------------------- /modules/48-conditionals/description.ru.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | name: Условные конструкции 4 | description: | 5 | Задача функции-предиката — получить ответ на вопрос, но обычно этого недостаточно и нужно выполнить определенное действие в зависимости от ответа. If и if-else  – конструкции Python, с помощью которых программист может выбирать необходимое поведение программы в зависимости от разных условий: пропускать одни инструкции и выполнять другие. Их и разберем на практике в этом модуле. 6 | -------------------------------------------------------------------------------- /modules/50-loops/10-while/Makefile: -------------------------------------------------------------------------------- 1 | test: 2 | @ test.sh 3 | -------------------------------------------------------------------------------- /modules/50-loops/10-while/en/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Modify the function `print_numbers()` so that it prints the numbers in reverse order. To do this, go from the upper bound to the lower bound. In other words, you should initialize the counter with the maximum value, and in the loop body, you should iterate it backwards down to the lower limit. 3 | 4 | Example call and output: 5 | 6 | ```python 7 | print_numbers(4) 8 | ``` 9 | 10 |
4
3
2
1
finished!
11 | -------------------------------------------------------------------------------- /modules/50-loops/10-while/en/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: While Loop 3 | tips: [] 4 | definitions: 5 | - name: While Loop 6 | description: an instruction to repeat the code as long as a given condition is met 7 | -------------------------------------------------------------------------------- /modules/50-loops/10-while/es/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Modifica la función `print_numbers()` para que imprima los números en orden inverso. Para ello, debes ir desde el límite superior hasta el límite inferior. Es decir, el contador debe inicializarse con el valor máximo y, en el cuerpo del ciclo, debe disminuir hasta el límite inferior. 3 | 4 | Ejemplo de llamada y salida: 5 | 6 | ```python 7 | print_numbers(4) 8 | ``` 9 | 10 |
4
3
2
1
¡finished!
11 | -------------------------------------------------------------------------------- /modules/50-loops/10-while/es/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Ciclo While 3 | tips: 4 | - | 5 | [Ciclo while](https://www.w3schools.com/python/python_while_loops.asp) 6 | definitions: 7 | - name: Ciclo While 8 | description: una instrucción para repetir código mientras se cumpla una condición. 9 | -------------------------------------------------------------------------------- /modules/50-loops/10-while/index.py: -------------------------------------------------------------------------------- 1 | def print_numbers(last_number): 2 | i = last_number 3 | while i > 0: 4 | print(i) 5 | i = i - 1 6 | print("finished!") 7 | -------------------------------------------------------------------------------- /modules/50-loops/10-while/ru/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Модифицируйте функцию `print_numbers()` так, чтобы она выводила числа в обратном порядке. Для этого нужно идти от верхней границы к нижней. То есть счётчик должен быть инициализирован максимальным значением, а в теле цикла его нужно уменьшать до нижней границы. 3 | 4 | Пример вызова и вывода: 5 | 6 | ```python 7 | print_numbers(4) 8 | ``` 9 | 10 |
4
3
2
1
finished!
11 | -------------------------------------------------------------------------------- /modules/50-loops/10-while/ru/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Цикл While 3 | tips: 4 | - | 5 | [Цикл while](https://www.w3schools.com/python/python_while_loops.asp) 6 | definitions: 7 | - name: Цикл While 8 | description: инструкция для повторения кода, пока удовлетворяется какое-то условие. 9 | -------------------------------------------------------------------------------- /modules/50-loops/10-while/test_code.py: -------------------------------------------------------------------------------- 1 | import index 2 | from hexlet.test import expect_output 3 | 4 | 5 | def test1(capsys): 6 | index.print_numbers(2) 7 | expect_output(capsys, "2\n1\nfinished!") 8 | 9 | 10 | def test2(capsys): 11 | index.print_numbers(4) 12 | expect_output(capsys, "4\n3\n2\n1\nfinished!") 13 | -------------------------------------------------------------------------------- /modules/50-loops/20-aggregation-numbers/Makefile: -------------------------------------------------------------------------------- 1 | test: 2 | @ test.sh 3 | -------------------------------------------------------------------------------- /modules/50-loops/20-aggregation-numbers/en/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Implement a function called `multiply_numbers_from_range()` that multiplies numbers in a specified range, including range boundaries. Call example: 3 | 4 | ```python 5 | multiply_numbers_from_range(1, 5) # 1 * 2 * 3 * 4 * 5 = 120 6 | multiply_numbers_from_range(2, 3) # 2 * 3 = 6 7 | multiply_numbers_from_range(6, 6) # 6 8 | ``` 9 | -------------------------------------------------------------------------------- /modules/50-loops/20-aggregation-numbers/en/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Data Aggregation (Numbers) 3 | tips: [] 4 | -------------------------------------------------------------------------------- /modules/50-loops/20-aggregation-numbers/es/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Implementa la función `multiply_numbers_from_range()`, que multiplica los números en el rango especificado, incluyendo los límites del rango. Ejemplo de llamada: 3 | 4 | ```python 5 | multiply_numbers_from_range(1, 5) # 1 * 2 * 3 * 4 * 5 = 120 6 | multiply_numbers_from_range(2, 3) # 2 * 3 = 6 7 | multiply_numbers_from_range(6, 6) # 6 8 | ``` 9 | -------------------------------------------------------------------------------- /modules/50-loops/20-aggregation-numbers/es/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Agregación de datos (Números) 3 | tips: 4 | - | 5 | [Iteración](https://es.wikipedia.org/wiki/Iteración) 6 | definitions: 7 | - name: Agregación 8 | description: >- 9 | Acumulación del resultado durante las iteraciones y trabajo con él después 10 | del bucle. 11 | -------------------------------------------------------------------------------- /modules/50-loops/20-aggregation-numbers/index.py: -------------------------------------------------------------------------------- 1 | def multiply_numbers_from_range(start, finish): 2 | i = start 3 | result = 1 4 | while i <= finish: 5 | result = result * i 6 | i = i + 1 7 | return result 8 | -------------------------------------------------------------------------------- /modules/50-loops/20-aggregation-numbers/ru/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Реализуйте функцию `multiply_numbers_from_range()`, которая принимает два числа, границы диапазона, и перемножает числа в нем, включая границы диапазона. Пример вызова: 3 | 4 | ```python 5 | multiply_numbers_from_range(1, 5) # 1 * 2 * 3 * 4 * 5 = 120 6 | multiply_numbers_from_range(2, 3) # 2 * 3 = 6 7 | multiply_numbers_from_range(6, 6) # 6 8 | ``` 9 | -------------------------------------------------------------------------------- /modules/50-loops/20-aggregation-numbers/ru/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Агрегация данных (Числа) 3 | tips: 4 | - | 5 | [Итерация](https://ru.wikipedia.org/wiki/Итерация_(программирование)) 6 | definitions: 7 | - name: Агрегация 8 | description: Накопление результата во время итераций и работа с ним после цикла. 9 | -------------------------------------------------------------------------------- /modules/50-loops/20-aggregation-numbers/test_code.py: -------------------------------------------------------------------------------- 1 | import index 2 | 3 | 4 | def test1(): 5 | assert index.multiply_numbers_from_range(2, 2) == 2 6 | assert index.multiply_numbers_from_range(1, 3) == 6 7 | assert index.multiply_numbers_from_range(1, 5) == 120 8 | assert index.multiply_numbers_from_range(6, 6) == 6 9 | -------------------------------------------------------------------------------- /modules/50-loops/23-aggregation-strings/Makefile: -------------------------------------------------------------------------------- 1 | test: 2 | @ test.sh 3 | -------------------------------------------------------------------------------- /modules/50-loops/23-aggregation-strings/en/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Implement a function called `join_numbers_from_range()` that combines all the numbers from a range into a string: 3 | 4 | ```python 5 | join_numbers_from_range(1, 1) # '1' 6 | join_numbers_from_range(2, 3) # '23' 7 | join_numbers_from_range(5, 10) # '5678910' 8 | ``` 9 | -------------------------------------------------------------------------------- /modules/50-loops/23-aggregation-strings/en/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Data Aggregation (Strings) 3 | tips: [] 4 | -------------------------------------------------------------------------------- /modules/50-loops/23-aggregation-strings/es/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Implementa la función `join_numbers_from_range()`, que une todos los números de un rango en una cadena: 3 | 4 | ```python 5 | join_numbers_from_range(1, 1) # '1' 6 | join_numbers_from_range(2, 3) # '23' 7 | join_numbers_from_range(5, 10) # '5678910' 8 | ``` 9 | -------------------------------------------------------------------------------- /modules/50-loops/23-aggregation-strings/es/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Agregación de datos (Cadenas) 3 | tips: 4 | - | 5 | [Iteración](https://es.wikipedia.org/wiki/Iteraci%C3%B3n) 6 | definitions: 7 | - name: Agregación 8 | description: >- 9 | Acumulación de resultados durante las iteraciones y manejo de estos 10 | después del bucle. 11 | -------------------------------------------------------------------------------- /modules/50-loops/23-aggregation-strings/index.py: -------------------------------------------------------------------------------- 1 | def join_numbers_from_range(start, end): 2 | i = start 3 | result = "" 4 | while i <= end: 5 | result = result + str(i) 6 | i = i + 1 7 | return result 8 | -------------------------------------------------------------------------------- /modules/50-loops/23-aggregation-strings/ru/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Реализуйте функцию `join_numbers_from_range()`, которая объединяет все числа из переданного диапазона в строку: 3 | 4 | ```python 5 | join_numbers_from_range(1, 1) # '1' 6 | join_numbers_from_range(2, 3) # '23' 7 | join_numbers_from_range(5, 10) # '5678910' 8 | ``` 9 | -------------------------------------------------------------------------------- /modules/50-loops/23-aggregation-strings/ru/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Агрегация данных (Строки) 3 | tips: 4 | - | 5 | [Итерация](https://ru.wikipedia.org/wiki/Итерация_(программирование)) 6 | definitions: 7 | - name: Агрегация 8 | description: Накопление результата во время итераций и работа с ним после цикла. 9 | -------------------------------------------------------------------------------- /modules/50-loops/23-aggregation-strings/test_code.py: -------------------------------------------------------------------------------- 1 | import index 2 | 3 | 4 | def test1(): 5 | assert index.join_numbers_from_range(2, 2) == "2" 6 | assert index.join_numbers_from_range(1, 5) == "12345" 7 | assert index.join_numbers_from_range(10, 12) == "101112" 8 | -------------------------------------------------------------------------------- /modules/50-loops/25-iteration-over-string/Makefile: -------------------------------------------------------------------------------- 1 | test: 2 | @ test.sh 3 | -------------------------------------------------------------------------------- /modules/50-loops/25-iteration-over-string/en/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Implement a function called `print_reversed_word_by_symbol()` that prints a word passed to it character by character, as in the example from the theory, but in reverse order. 3 | 4 | ```python 5 | word = 'Hexlet' 6 | 7 | print_reversed_word_by_symbol(word) 8 | # => 't' 9 | # => 'e' 10 | # => 'l' 11 | # => 'x' 12 | # => 'e' 13 | # => 'H' 14 | ``` 15 | -------------------------------------------------------------------------------- /modules/50-loops/25-iteration-over-string/en/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Traversing Strings 3 | tips: [] 4 | -------------------------------------------------------------------------------- /modules/50-loops/25-iteration-over-string/es/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Implementa la función `print_reversed_word_by_symbol()`, que imprime la palabra pasada como argumento carácter por carácter, como se muestra en el ejemplo de la teoría, pero en orden inverso. 3 | 4 | ```python 5 | word = 'Hexlet' 6 | 7 | print_reversed_word_by_symbol(word) 8 | # => 't' 9 | # => 'e' 10 | # => 'l' 11 | # => 'x' 12 | # => 'e' 13 | # => 'H' 14 | ``` 15 | -------------------------------------------------------------------------------- /modules/50-loops/25-iteration-over-string/es/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Recorrido de cadenas 3 | tips: 4 | - | 5 | [Iteración](https://es.wikipedia.org/wiki/Iteración) 6 | -------------------------------------------------------------------------------- /modules/50-loops/25-iteration-over-string/index.py: -------------------------------------------------------------------------------- 1 | def print_reversed_word_by_symbol(word): 2 | i = len(word) - 1 3 | while i >= 0: 4 | print(word[i]) 5 | i = i - 1 6 | -------------------------------------------------------------------------------- /modules/50-loops/25-iteration-over-string/ru/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Реализуйте функцию `print_reversed_word_by_symbol()`, которая печатает переданное слово посимвольно, как в примере из теории, но делает это в обратном порядке. 3 | 4 | ```python 5 | word = 'Hexlet' 6 | 7 | print_reversed_word_by_symbol(word) 8 | # => 't' 9 | # => 'e' 10 | # => 'l' 11 | # => 'x' 12 | # => 'e' 13 | # => 'H' 14 | ``` 15 | -------------------------------------------------------------------------------- /modules/50-loops/25-iteration-over-string/ru/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Обход строк 3 | tips: 4 | - | 5 | [Итерация](https://ru.wikipedia.org/wiki/Итерация_(программирование)) 6 | -------------------------------------------------------------------------------- /modules/50-loops/25-iteration-over-string/test_code.py: -------------------------------------------------------------------------------- 1 | import index 2 | from hexlet.test import expect_output 3 | 4 | 5 | def test(capsys): 6 | index.print_reversed_word_by_symbol("Hexlet") 7 | expected = "t\ne\nl\nx\ne\nH" 8 | expect_output(capsys, expected) 9 | -------------------------------------------------------------------------------- /modules/50-loops/26-conditions-inside-loops/Makefile: -------------------------------------------------------------------------------- 1 | test: 2 | @ test.sh 3 | -------------------------------------------------------------------------------- /modules/50-loops/26-conditions-inside-loops/en/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | The function from the theory is case-sensitive. I.e., `A' and `a' are different characters from its point of view. Write a version of this function that isn't case-sensitive: 3 | 4 | ```python 5 | count_chars('HexlEt', 'e') # 2 6 | count_chars('HexlEt', 'E') # 2 7 | ``` 8 | -------------------------------------------------------------------------------- /modules/50-loops/26-conditions-inside-loops/en/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Conditions Inside the Body of the Loop 3 | tips: [] 4 | -------------------------------------------------------------------------------- /modules/50-loops/26-conditions-inside-loops/es/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | La función de la teoría tiene en cuenta el caso de las letras. Es decir, `A` y `a` son considerados caracteres diferentes. Implementa una versión de esta misma función en la que no importe el caso de las letras: 3 | 4 | ```python 5 | count_chars('HexlEt', 'e') # 2 6 | count_chars('HexlEt', 'E') # 2 7 | ``` 8 | -------------------------------------------------------------------------------- /modules/50-loops/26-conditions-inside-loops/es/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Condiciones dentro de un bucle 3 | tips: [] 4 | -------------------------------------------------------------------------------- /modules/50-loops/26-conditions-inside-loops/index.py: -------------------------------------------------------------------------------- 1 | def count_chars(string, char): 2 | index = 0 3 | count = 0 4 | while index < len(string): 5 | if string[index].upper() == char.upper(): 6 | count = count + 1 7 | index = index + 1 8 | return count 9 | -------------------------------------------------------------------------------- /modules/50-loops/26-conditions-inside-loops/ru/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Функция из теории учитывает регистр букв. То есть `A` и `a` с её точки зрения разные символы. Реализуйте вариант этой же функции, так чтобы регистр букв был не важен: 3 | 4 | ```python 5 | count_chars('HexlEt', 'e') # 2 6 | count_chars('HexlEt', 'E') # 2 7 | ``` 8 | -------------------------------------------------------------------------------- /modules/50-loops/26-conditions-inside-loops/ru/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Условия внутри тела цикла 3 | tips: [] 4 | -------------------------------------------------------------------------------- /modules/50-loops/26-conditions-inside-loops/test_code.py: -------------------------------------------------------------------------------- 1 | import index 2 | 3 | 4 | def test1(): 5 | assert index.count_chars("axe", "a") == 1 6 | assert index.count_chars("", "a") == 0 7 | assert index.count_chars("opPa", "p") == 2 8 | assert index.count_chars("opPa", "P") == 2 9 | -------------------------------------------------------------------------------- /modules/50-loops/28-build-string/Makefile: -------------------------------------------------------------------------------- 1 | test: 2 | @ test.sh 3 | -------------------------------------------------------------------------------- /modules/50-loops/28-build-string/en/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Forming Strings in Loops 3 | tips: [] 4 | -------------------------------------------------------------------------------- /modules/50-loops/28-build-string/es/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Formación de cadenas en bucles 3 | tips: 4 | - | 5 | [Iteración](https://es.wikipedia.org/wiki/Iteraci%C3%B3n) 6 | -------------------------------------------------------------------------------- /modules/50-loops/28-build-string/index.py: -------------------------------------------------------------------------------- 1 | def my_substr(string, length): 2 | result_string = "" 3 | index = 0 4 | while index < length: 5 | result_string = result_string + string[index] 6 | index = index + 1 7 | 8 | return result_string 9 | -------------------------------------------------------------------------------- /modules/50-loops/28-build-string/ru/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Формирование строк в циклах 3 | tips: 4 | - | 5 | [Итерация](https://ru.wikipedia.org/wiki/Итерация_(программирование)) 6 | -------------------------------------------------------------------------------- /modules/50-loops/28-build-string/test_code.py: -------------------------------------------------------------------------------- 1 | import index 2 | 3 | 4 | def test1(): 5 | assert index.my_substr("got", 3) == "got" 6 | assert index.my_substr("got", 2) == "go" 7 | assert index.my_substr("got", 1) == "g" 8 | -------------------------------------------------------------------------------- /modules/50-loops/29-edge-cases/Makefile: -------------------------------------------------------------------------------- 1 | test: 2 | @ test.sh 3 | -------------------------------------------------------------------------------- /modules/50-loops/29-edge-cases/en/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Edge cases 3 | tips: [] 4 | -------------------------------------------------------------------------------- /modules/50-loops/29-edge-cases/es/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Casos límite 3 | tips: [] 4 | -------------------------------------------------------------------------------- /modules/50-loops/29-edge-cases/index.py: -------------------------------------------------------------------------------- 1 | def is_arguments_for_substr_correct(string, index, length): 2 | if index < 0: 3 | return False 4 | elif length < 0: 5 | return False 6 | elif index > len(string) - 1: 7 | return False 8 | elif index + length > len(string): 9 | return False 10 | return True 11 | -------------------------------------------------------------------------------- /modules/50-loops/29-edge-cases/ru/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Пограничные случаи 3 | tips: [] 4 | -------------------------------------------------------------------------------- /modules/50-loops/30-syntactic-sugar/Makefile: -------------------------------------------------------------------------------- 1 | test: 2 | @ test.sh 3 | -------------------------------------------------------------------------------- /modules/50-loops/30-syntactic-sugar/en/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Implement a function called `filter_string()` that takes a string and a character as input, and returns a new string with the character removed from every point in the string. Try not to use the built-in methods for working with the string in your solution. 3 | 4 | ```python 5 | text = 'If I look back I am lost' 6 | filter_string(text, 'I') # 'f look back am lost' 7 | filter_string(text, 'o') # 'If I lk back I am lst' 8 | ``` 9 | -------------------------------------------------------------------------------- /modules/50-loops/30-syntactic-sugar/en/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Syntactic Sugar 3 | tips: [] 4 | -------------------------------------------------------------------------------- /modules/50-loops/30-syntactic-sugar/es/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Implementa la función `filter_string()`, que recibe una cadena y un carácter, y devuelve una nueva cadena en la que se elimina el carácter pasado en todas sus posiciones. Intenta no utilizar métodos incorporados para trabajar con cadenas en tu solución. 3 | 4 | ```python 5 | text = 'If I look back I am lost' 6 | filter_string(text, 'I') # 'f look back am lost' 7 | filter_string(text, 'o') # 'If I lk back I am lst' 8 | ``` 9 | -------------------------------------------------------------------------------- /modules/50-loops/30-syntactic-sugar/es/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Azúcar sintáctico 3 | tips: 4 | - | 5 | [Azúcar sintáctico](https://es.wikipedia.org/wiki/Azúcar_sintáctico) 6 | definitions: 7 | - name: Azúcar sintáctico 8 | description: > 9 | son características sintácticas que no afectan el comportamiento en sí del 10 | programa, pero hacen que el uso del lenguaje sea más conveniente para los 11 | humanos. 12 | -------------------------------------------------------------------------------- /modules/50-loops/30-syntactic-sugar/index.py: -------------------------------------------------------------------------------- 1 | def filter_string(text, char): 2 | index = 0 3 | result = "" 4 | while index < len(text): 5 | current_char = text[index] 6 | if current_char != char: 7 | result = f"{result}{current_char}" 8 | index += 1 9 | return result 10 | -------------------------------------------------------------------------------- /modules/50-loops/30-syntactic-sugar/ru/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Реализуйте функцию `filter_string()`, принимающую на вход строку и символ, и возвращающую новую строку, в которой удален переданный символ во всех его позициях. Старайтесь не использовать встроенные методы работы со строкой в своем решении. 3 | 4 | ```python 5 | text = 'If I look back I am lost' 6 | filter_string(text, 'I') # 'f look back am lost' 7 | filter_string(text, 'o') # 'If I lk back I am lst' 8 | ``` 9 | -------------------------------------------------------------------------------- /modules/50-loops/30-syntactic-sugar/ru/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Синтаксический сахар 3 | tips: 4 | - | 5 | [Синтаксический сахар](https://ru.wikipedia.org/wiki/Синтаксический_сахар) 6 | definitions: 7 | - name: Синтаксический сахар 8 | description: > 9 | это синтаксические возможности, применение которых не влияет на поведение 10 | программы, но делает использование языка более удобным для человека. 11 | -------------------------------------------------------------------------------- /modules/50-loops/30-syntactic-sugar/test_code.py: -------------------------------------------------------------------------------- 1 | import index 2 | 3 | 4 | def test1(): 5 | text = "If I look back I am lost" 6 | assert index.filter_string(text, "w") == "If I look back I am lost" 7 | assert index.filter_string(text, "I") == "f look back am lost" 8 | assert index.filter_string("zz zorro", "z") == " orro" 9 | -------------------------------------------------------------------------------- /modules/50-loops/55-return-from-loops/Makefile: -------------------------------------------------------------------------------- 1 | test: 2 | @ test.sh 3 | -------------------------------------------------------------------------------- /modules/50-loops/55-return-from-loops/en/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Implement a function `is_contains_char()` that checks case-sensitively if a string contains a specified letter. The function takes two parameters: 3 | 4 | * The line 5 | * Search letter 6 | 7 | ```python 8 | print(is_contains_char('Hexlet', 'H')) # => True 9 | print(is_contains_char('Hexlet', 'h')) # => False 10 | print(is_contains_char('Awesomeness', 'm')) # => True 11 | print(is_contains_char('Awesomeness', 'd')) # => False 12 | ``` 13 | -------------------------------------------------------------------------------- /modules/50-loops/55-return-from-loops/en/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Return from cycles 3 | tips: 4 | - '[List of prime numbers](https://en.wikipedia.org/wiki/List_of_prime_numbers)' 5 | -------------------------------------------------------------------------------- /modules/50-loops/55-return-from-loops/es/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Vuelta desde bucles 3 | tips: 4 | - >- 5 | [Lista de números 6 | primos](https://es.wikipedia.org/wiki/Anexo:Números_primos) 7 | definitions: 8 | - name: Agregación 9 | description: >- 10 | Acumular resultados durante las iteraciones y trabajar con ellos después 11 | del bucle. 12 | -------------------------------------------------------------------------------- /modules/50-loops/55-return-from-loops/index.py: -------------------------------------------------------------------------------- 1 | def is_contains_char(string, char): 2 | index = 0 3 | while index < len(string): 4 | if string[index] == char: 5 | return True 6 | index += 1 7 | return False 8 | -------------------------------------------------------------------------------- /modules/50-loops/55-return-from-loops/ru/EXERCISE.md: -------------------------------------------------------------------------------- 1 | 2 | Реализуйте функцию `is_contains_char()`, которая проверяет с учётом регистра, содержит ли переданная строка указанную букву. Функция принимает два параметра: 3 | 4 | * Строка 5 | * Буква для поиска 6 | 7 | ```python 8 | print(is_contains_char('Hexlet', 'H')) # => True 9 | print(is_contains_char('Hexlet', 'h')) # => False 10 | print(is_contains_char('Awesomeness', 'm')) # => True 11 | print(is_contains_char('Awesomeness', 'd')) # => False 12 | ``` 13 | -------------------------------------------------------------------------------- /modules/50-loops/55-return-from-loops/ru/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Возврат из циклов 3 | tips: 4 | - '[Список простых чисел](https://ru.wikipedia.org/wiki/Список_простых_чисел)' 5 | definitions: 6 | - name: Агрегация 7 | description: Накопление результата во время итераций и работа с ним после цикла. 8 | -------------------------------------------------------------------------------- /modules/50-loops/55-return-from-loops/test_code.py: -------------------------------------------------------------------------------- 1 | from index import is_contains_char 2 | 3 | 4 | def test_is_contains_char(): 5 | assert is_contains_char("Hexlet", "H") is True 6 | assert is_contains_char("Hexlet", "h") is False 7 | assert is_contains_char("Awesomeness", "m") is True 8 | assert is_contains_char("Awesomeness", "d") is False 9 | assert is_contains_char("Awesomeness", "o") is True 10 | -------------------------------------------------------------------------------- /modules/50-loops/70-for/Makefile: -------------------------------------------------------------------------------- 1 | test: 2 | @ test.sh 3 | -------------------------------------------------------------------------------- /modules/50-loops/70-for/en/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Cycle For 3 | tips: [] 4 | -------------------------------------------------------------------------------- /modules/50-loops/70-for/es/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Ciclo For 3 | tips: [] 4 | definitions: 5 | - name: Agregación 6 | description: >- 7 | Acumulación de resultados durante las iteraciones y manejo de estos 8 | después del ciclo. 9 | -------------------------------------------------------------------------------- /modules/50-loops/70-for/index.py: -------------------------------------------------------------------------------- 1 | def filter_string(text, char): 2 | result = "" 3 | for current_char in text: 4 | if current_char.upper() != char.upper(): 5 | result += current_char 6 | return result 7 | -------------------------------------------------------------------------------- /modules/50-loops/70-for/ru/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Цикл For 3 | tips: [] 4 | definitions: 5 | - name: Агрегация 6 | description: Накопление результата во время итераций и работа с ним после цикла. 7 | -------------------------------------------------------------------------------- /modules/50-loops/70-for/test_code.py: -------------------------------------------------------------------------------- 1 | from index import filter_string 2 | 3 | 4 | def test1(): 5 | text = "If I look forward I am win" 6 | assert filter_string(text, "z") == "If I look forward I am win" 7 | assert filter_string(text, "I") == "f look forward am wn" 8 | assert filter_string("zz zorro", "z") == " orro" 9 | -------------------------------------------------------------------------------- /modules/50-loops/80-for-in-range/Makefile: -------------------------------------------------------------------------------- 1 | test: 2 | @ test.sh 3 | -------------------------------------------------------------------------------- /modules/50-loops/80-for-in-range/en/EXERCISE.md: -------------------------------------------------------------------------------- 1 | Implement the `print_table_of_squares(from, to)` function that prints squares of numbers to the screen. It first `from` and last `to` a number prints the string `square of is ` 2 | 3 | Call examples: 4 | 5 | ```python 6 | print_table_of_squares(1, 3) 7 | # => square of 1 is 1 8 | # => square of 2 is 4 9 | # => square of 3 is 9 10 | ``` 11 | -------------------------------------------------------------------------------- /modules/50-loops/80-for-in-range/en/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: For loop and range function 3 | tips: [] 4 | definitions: [] 5 | -------------------------------------------------------------------------------- /modules/50-loops/80-for-in-range/index.py: -------------------------------------------------------------------------------- 1 | def print_table_of_squares(first, last): 2 | for i in range(first, last + 1): 3 | square = i * i 4 | print(f"square of {i} is {square}") 5 | -------------------------------------------------------------------------------- /modules/50-loops/80-for-in-range/ru/EXERCISE.md: -------------------------------------------------------------------------------- 1 | Реализуйте функцию `print_table_of_squares(first, last)`, которая печатает на экран квадраты чисел. Она первое `first` и последнее `last` число печатает строку `square of <число> is <результат>` 2 | 3 | Примеры вызова: 4 | 5 | ```python 6 | print_table_of_squares(1, 3) 7 | # => square of 1 is 1 8 | # => square of 2 is 4 9 | # => square of 3 is 9 10 | ``` 11 | -------------------------------------------------------------------------------- /modules/50-loops/80-for-in-range/ru/data.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Цикл for и функция range 3 | tips: [] 4 | definitions: [] 5 | -------------------------------------------------------------------------------- /modules/50-loops/80-for-in-range/test_code.py: -------------------------------------------------------------------------------- 1 | from index import print_table_of_squares 2 | from hexlet.test import expect_output 3 | 4 | 5 | def test(capsys): 6 | expected = """square of 1 is 1 7 | square of 2 is 4 8 | square of 3 is 9 9 | square of 4 is 16 10 | square of 5 is 25 11 | square of 6 is 36 12 | square of 7 is 49 13 | square of 8 is 64 14 | square of 9 is 81 15 | square of 10 is 100""" 16 | 17 | print_table_of_squares(1, 10) 18 | expect_output(capsys, expected) 19 | -------------------------------------------------------------------------------- /pyproject.toml: -------------------------------------------------------------------------------- 1 | [project] 2 | name = "exercises" 3 | version = "0.1.0" 4 | requires-python = ">=3.11" 5 | 6 | dependencies = [ 7 | "ruff", 8 | "pytest" 9 | ] 10 | -------------------------------------------------------------------------------- /spec.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | language: 4 | docker_image: "hexletbasics/exercises-python" 5 | extension: python 6 | exercise_filename: index.py 7 | exercise_test_filename: test_code.py 8 | learn_as: first_language 9 | progress: completed 10 | name: Python 11 | -------------------------------------------------------------------------------- /src/hexlet/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hexlet-basics/exercises-python/d551f48fe1a363482a9a5e0019190fffbe36a8bd/src/hexlet/__init__.py -------------------------------------------------------------------------------- /src/hexlet/test.py: -------------------------------------------------------------------------------- 1 | import importlib 2 | import types 3 | 4 | __all__ = ("expect_output",) 5 | 6 | 7 | def expect_output(capsys, expected): 8 | importlib.import_module("index") 9 | out, _err = capsys.readouterr() 10 | actual = out.strip() 11 | 12 | if isinstance(expected, types.FunctionType): 13 | expected(actual) 14 | else: 15 | assert actual == expected 16 | 17 | print("\n") 18 | print(out) 19 | -------------------------------------------------------------------------------- /src/setup/__init__.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | 3 | pytest.register_assert_rewrite("hexlet") 4 | --------------------------------------------------------------------------------