├── .nojekyll ├── doc-requirements.txt ├── requirements.txt ├── source ├── images │ ├── house.png │ ├── left.png │ ├── dashed.png │ ├── default.png │ ├── forward.png │ ├── hexagon.png │ ├── shapes.png │ ├── square.png │ ├── cc-by-sa.png │ ├── floorplan.jpg │ ├── honeycomb.png │ ├── ots_logo_v.png │ ├── progress.gif │ ├── rectangle.png │ ├── triangle.png │ ├── ots_logo_fb.png │ ├── it_uni_copen_2.jpg │ ├── tiltedsquares.png │ └── dashedprogressing.png ├── _locales │ └── de │ │ └── LC_MESSAGES │ │ └── pybeginners.mo ├── _templates │ ├── layout.html │ ├── navbartoc.html │ ├── sourcelink.html │ └── relations.html ├── index.rst ├── locale │ ├── en │ │ └── LC_MESSAGES │ │ │ ├── index.po │ │ │ ├── copyright.po │ │ │ ├── logical_operators.po │ │ │ ├── variables.po │ │ │ ├── functions_parameters.po │ │ │ ├── conditionals.po │ │ │ ├── where_to_go.po │ │ │ ├── conditional_loops.po │ │ │ ├── functions.po │ │ │ └── loops.po │ ├── fr │ │ └── LC_MESSAGES │ │ │ ├── index.po │ │ │ ├── copyright.po │ │ │ ├── logical_operators.po │ │ │ ├── variables.po │ │ │ ├── functions_parameters.po │ │ │ ├── conditionals.po │ │ │ ├── where_to_go.po │ │ │ ├── conditional_loops.po │ │ │ ├── functions.po │ │ │ └── loops.po │ ├── ko │ │ └── LC_MESSAGES │ │ │ ├── index.po │ │ │ ├── copyright.po │ │ │ ├── logical_operators.po │ │ │ ├── variables.po │ │ │ └── where_to_go.po │ ├── ro │ │ └── LC_MESSAGES │ │ │ ├── index.po │ │ │ ├── copyright.po │ │ │ ├── logical_operators.po │ │ │ └── variables.po │ ├── ru │ │ └── LC_MESSAGES │ │ │ ├── index.po │ │ │ ├── copyright.po │ │ │ ├── logical_operators.po │ │ │ └── variables.po │ ├── es_CL │ │ └── LC_MESSAGES │ │ │ ├── index.po │ │ │ ├── copyright.po │ │ │ ├── logical_operators.po │ │ │ └── variables.po │ └── de │ │ └── LC_MESSAGES │ │ ├── index.po │ │ ├── copyright.po │ │ ├── logical_operators.po │ │ └── variables.po ├── copyright.rst ├── _static │ ├── spoilers.js │ └── custom.css ├── logical_operators.rst ├── variables.rst ├── functions_parameters.rst ├── conditionals.rst ├── where_to_go.rst ├── conditional_loops.rst ├── loops.rst └── functions.rst ├── .gitignore ├── create_tx.sh ├── _static └── index.html ├── .tx └── config ├── fabfile.py └── README.rst /.nojekyll: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /doc-requirements.txt: -------------------------------------------------------------------------------- 1 | sphinx-bootstrap-theme 2 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | Fabric 2 | Sphinx 3 | sphinx-intl 4 | -r doc-requirements.txt 5 | -------------------------------------------------------------------------------- /source/images/house.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenTechSchool/python-beginners/HEAD/source/images/house.png -------------------------------------------------------------------------------- /source/images/left.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenTechSchool/python-beginners/HEAD/source/images/left.png -------------------------------------------------------------------------------- /source/images/dashed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenTechSchool/python-beginners/HEAD/source/images/dashed.png -------------------------------------------------------------------------------- /source/images/default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenTechSchool/python-beginners/HEAD/source/images/default.png -------------------------------------------------------------------------------- /source/images/forward.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenTechSchool/python-beginners/HEAD/source/images/forward.png -------------------------------------------------------------------------------- /source/images/hexagon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenTechSchool/python-beginners/HEAD/source/images/hexagon.png -------------------------------------------------------------------------------- /source/images/shapes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenTechSchool/python-beginners/HEAD/source/images/shapes.png -------------------------------------------------------------------------------- /source/images/square.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenTechSchool/python-beginners/HEAD/source/images/square.png -------------------------------------------------------------------------------- /source/images/cc-by-sa.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenTechSchool/python-beginners/HEAD/source/images/cc-by-sa.png -------------------------------------------------------------------------------- /source/images/floorplan.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenTechSchool/python-beginners/HEAD/source/images/floorplan.jpg -------------------------------------------------------------------------------- /source/images/honeycomb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenTechSchool/python-beginners/HEAD/source/images/honeycomb.png -------------------------------------------------------------------------------- /source/images/ots_logo_v.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenTechSchool/python-beginners/HEAD/source/images/ots_logo_v.png -------------------------------------------------------------------------------- /source/images/progress.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenTechSchool/python-beginners/HEAD/source/images/progress.gif -------------------------------------------------------------------------------- /source/images/rectangle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenTechSchool/python-beginners/HEAD/source/images/rectangle.png -------------------------------------------------------------------------------- /source/images/triangle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenTechSchool/python-beginners/HEAD/source/images/triangle.png -------------------------------------------------------------------------------- /source/images/ots_logo_fb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenTechSchool/python-beginners/HEAD/source/images/ots_logo_fb.png -------------------------------------------------------------------------------- /source/images/it_uni_copen_2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenTechSchool/python-beginners/HEAD/source/images/it_uni_copen_2.jpg -------------------------------------------------------------------------------- /source/images/tiltedsquares.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenTechSchool/python-beginners/HEAD/source/images/tiltedsquares.png -------------------------------------------------------------------------------- /source/images/dashedprogressing.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenTechSchool/python-beginners/HEAD/source/images/dashedprogressing.png -------------------------------------------------------------------------------- /source/_locales/de/LC_MESSAGES/pybeginners.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenTechSchool/python-beginners/HEAD/source/_locales/de/LC_MESSAGES/pybeginners.mo -------------------------------------------------------------------------------- /source/_templates/layout.html: -------------------------------------------------------------------------------- 1 | {% extends "!layout.html" %} 2 | {% set script_files = script_files + ["_static/spoilers.js"] %} 3 | {% set css_files = css_files + ["_static/custom.css"] %} 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | ._* 3 | *.pyc 4 | 5 | bin 6 | clear 7 | include 8 | lib 9 | _build 10 | source/locale/*/*/*.mo 11 | source/_locales/*/*/*.mo 12 | .transifexrc 13 | *.pot 14 | *.mo 15 | -------------------------------------------------------------------------------- /source/_templates/navbartoc.html: -------------------------------------------------------------------------------- 1 | 11 | -------------------------------------------------------------------------------- /create_tx.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/bash 2 | project="python-for-beginners" 3 | pots="_build/locale/en" 4 | pos="source/locale//LC_MESSAGES" 5 | 6 | for f in $pots/*.pot; do 7 | r=$(basename $f '.pot') 8 | echo $f 9 | echo "$project.$r" 10 | tx set --auto-local -r "$project.$r" \ 11 | "$pos/$r.po" \ 12 | --source-file "$f" \ 13 | --source-language=en --execute 14 | done 15 | -------------------------------------------------------------------------------- /source/index.rst: -------------------------------------------------------------------------------- 1 | Introduction to Programming with Python 2 | *************************************** 3 | 4 | .. only:: not latex 5 | 6 | Table of contents: 7 | 8 | .. toctree:: 9 | :maxdepth: 2 10 | 11 | getting_started 12 | simple_drawing 13 | variables 14 | loops 15 | functions 16 | functions_parameters 17 | conditionals 18 | conditional_loops 19 | logical_operators 20 | where_to_go 21 | copyright 22 | -------------------------------------------------------------------------------- /source/locale/en/LC_MESSAGES/index.po: -------------------------------------------------------------------------------- 1 | # 2 | msgid "" 3 | msgstr "" 4 | "Project-Id-Version: Introduction to Programming with Python 0.1\n" 5 | "Report-Msgid-Bugs-To: \n" 6 | "POT-Creation-Date: 2013-10-25 09:37\n" 7 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 8 | "Last-Translator: FULL NAME \n" 9 | "Language-Team: LANGUAGE \n" 10 | "MIME-Version: 1.0\n" 11 | "Content-Type: text/plain; charset=UTF-8\n" 12 | "Content-Transfer-Encoding: 8bit\n" 13 | 14 | #: ../../../source/index.rst:2 15 | msgid "Introduction to Programming with Python" 16 | msgstr "" 17 | 18 | #: ../../../source/index.rst:5 19 | msgid "Table of contents:" 20 | msgstr "" 21 | -------------------------------------------------------------------------------- /source/locale/fr/LC_MESSAGES/index.po: -------------------------------------------------------------------------------- 1 | # 2 | msgid "" 3 | msgstr "" 4 | "Project-Id-Version: Introduction to Programming with Python 0.1\n" 5 | "Report-Msgid-Bugs-To: \n" 6 | "POT-Creation-Date: 2013-10-25 09:14\n" 7 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 8 | "Last-Translator: FULL NAME \n" 9 | "Language-Team: LANGUAGE \n" 10 | "MIME-Version: 1.0\n" 11 | "Content-Type: text/plain; charset=UTF-8\n" 12 | "Content-Transfer-Encoding: 8bit\n" 13 | 14 | #: ../../../source/index.rst:2 15 | msgid "Introduction to Programming with Python" 16 | msgstr "" 17 | 18 | #: ../../../source/index.rst:5 19 | msgid "Table of contents:" 20 | msgstr "" 21 | -------------------------------------------------------------------------------- /source/_templates/sourcelink.html: -------------------------------------------------------------------------------- 1 | {%- if has_source %} 2 | 18 | {%- endif %} 19 | -------------------------------------------------------------------------------- /source/locale/en/LC_MESSAGES/copyright.po: -------------------------------------------------------------------------------- 1 | # 2 | msgid "" 3 | msgstr "" 4 | "Project-Id-Version: Introduction to Programming with Python 0.1\n" 5 | "Report-Msgid-Bugs-To: \n" 6 | "POT-Creation-Date: 2013-10-25 09:37\n" 7 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 8 | "Last-Translator: FULL NAME \n" 9 | "Language-Team: LANGUAGE \n" 10 | "MIME-Version: 1.0\n" 11 | "Content-Type: text/plain; charset=UTF-8\n" 12 | "Content-Transfer-Encoding: 8bit\n" 13 | 14 | #: ../../../source/copyright.rst:2 15 | msgid "License" 16 | msgstr "" 17 | 18 | #: ../../../source/copyright.rst:4 19 | msgid "" 20 | "This work is licensed under the Creative Commons Attribution-ShareAlike 3.0 " 21 | "Unported License. To view a copy of this license, visit " 22 | "http://creativecommons.org/licenses/by-sa/3.0/ or send a letter to Creative " 23 | "Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, " 24 | "USA." 25 | msgstr "" 26 | -------------------------------------------------------------------------------- /source/locale/fr/LC_MESSAGES/copyright.po: -------------------------------------------------------------------------------- 1 | # 2 | msgid "" 3 | msgstr "" 4 | "Project-Id-Version: Introduction to Programming with Python 0.1\n" 5 | "Report-Msgid-Bugs-To: \n" 6 | "POT-Creation-Date: 2013-10-25 09:14\n" 7 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 8 | "Last-Translator: FULL NAME \n" 9 | "Language-Team: LANGUAGE \n" 10 | "MIME-Version: 1.0\n" 11 | "Content-Type: text/plain; charset=UTF-8\n" 12 | "Content-Transfer-Encoding: 8bit\n" 13 | 14 | #: ../../../source/copyright.rst:2 15 | msgid "License" 16 | msgstr "" 17 | 18 | #: ../../../source/copyright.rst:4 19 | msgid "" 20 | "This work is licensed under the Creative Commons Attribution-ShareAlike 3.0 " 21 | "Unported License. To view a copy of this license, visit " 22 | "http://creativecommons.org/licenses/by-sa/3.0/ or send a letter to Creative " 23 | "Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, " 24 | "USA." 25 | msgstr "" 26 | -------------------------------------------------------------------------------- /source/copyright.rst: -------------------------------------------------------------------------------- 1 | License 2 | ******* 3 | 4 | This work is licensed under the Creative Commons Attribution-ShareAlike 5 | 3.0 Unported License. To view a copy of this license, visit 6 | http://creativecommons.org/licenses/by-sa/3.0/ or send a letter to 7 | Creative Commons, 444 Castro Street, Suite 900, Mountain View, 8 | California, 94041, USA. 9 | 10 | .. |cc-by-sa| image:: /images/cc-by-sa.png 11 | .. centered:: |cc-by-sa| 12 | 13 | Contributors 14 | ============ 15 | 16 | The following people have contributed to this material, in alphabetical order: 17 | 18 | .. raw:: latex 19 | 20 | { 21 | \setlength{\parskip}{0mm} 22 | 23 | .. contributors:: 24 | 25 | .. raw:: latex 26 | 27 | } 28 | 29 | (This list is automatically generated from our `source repository`__.) 30 | 31 | __ https://github.com/opentechschool/python-beginners 32 | 33 | The material is legally maintained by 34 | 35 | | OpenTechSchool e.V. 36 | | c/o co.up 37 | | Adalbertstr. 8 38 | | 10999 Berlin, Germany 39 | -------------------------------------------------------------------------------- /source/locale/ko/LC_MESSAGES/index.po: -------------------------------------------------------------------------------- 1 | # SOME DESCRIPTIVE TITLE. 2 | # Copyright (C) 2012–2014, OpenTechSchool and contributors 3 | # This file is distributed under the same license as the Introduction to Programming with Python package. 4 | # 5 | # Translators: 6 | # Seong-ho Cho , 2014 7 | msgid "" 8 | msgstr "" 9 | "Project-Id-Version: Python for beginners\n" 10 | "Report-Msgid-Bugs-To: \n" 11 | "POT-Creation-Date: 2014-06-09 11:00+1000\n" 12 | "PO-Revision-Date: 2014-02-22 21:02+0000\n" 13 | "Last-Translator: Seong-ho Cho \n" 14 | "Language-Team: Korean (http://www.transifex.com/projects/p/python-for-beginners/language/ko/)\n" 15 | "MIME-Version: 1.0\n" 16 | "Content-Type: text/plain; charset=UTF-8\n" 17 | "Content-Transfer-Encoding: 8bit\n" 18 | "Language: ko\n" 19 | "Plural-Forms: nplurals=1; plural=0;\n" 20 | 21 | # ed81ac1143214436b0ac20d31a723e3e 22 | #: ../../../source/index.rst:2 23 | msgid "Introduction to Programming with Python" 24 | msgstr "파이썬 프로그래밍 소개" 25 | 26 | # db0c91bd12784cd0a6500ae9e9fd291c 27 | #: ../../../source/index.rst:6 28 | msgid "Table of contents:" 29 | msgstr "목차:" 30 | -------------------------------------------------------------------------------- /source/locale/ro/LC_MESSAGES/index.po: -------------------------------------------------------------------------------- 1 | # SOME DESCRIPTIVE TITLE. 2 | # Copyright (C) 2012–2014, OpenTechSchool and contributors 3 | # This file is distributed under the same license as the Introduction to Programming with Python package. 4 | # 5 | # Translators: 6 | # Razvan Stefanescu , 2015 7 | msgid "" 8 | msgstr "" 9 | "Project-Id-Version: Python for beginners\n" 10 | "Report-Msgid-Bugs-To: \n" 11 | "POT-Creation-Date: 2015-10-02 06:32+1000\n" 12 | "PO-Revision-Date: 2015-04-01 09:47+0000\n" 13 | "Last-Translator: Razvan Stefanescu \n" 14 | "Language-Team: Romanian (http://www.transifex.com/opentechschool/python-for-beginners/language/ro/)\n" 15 | "MIME-Version: 1.0\n" 16 | "Content-Type: text/plain; charset=UTF-8\n" 17 | "Content-Transfer-Encoding: 8bit\n" 18 | "Language: ro\n" 19 | "Plural-Forms: nplurals=3; plural=(n==1?0:(((n%100>19)||((n%100==0)&&(n!=0)))?2:1));\n" 20 | 21 | #: ../../../source/index.rst:2 22 | msgid "Introduction to Programming with Python" 23 | msgstr "Introducere în Programare utilizând Python" 24 | 25 | #: ../../../source/index.rst:6 26 | msgid "Table of contents:" 27 | msgstr "Cuprins:" 28 | -------------------------------------------------------------------------------- /source/locale/ru/LC_MESSAGES/index.po: -------------------------------------------------------------------------------- 1 | # SOME DESCRIPTIVE TITLE. 2 | # Copyright (C) 2012–2014, OpenTechSchool and contributors 3 | # This file is distributed under the same license as the Introduction to Programming with Python package. 4 | # 5 | # Translators: 6 | # sorrymak , 2013 7 | msgid "" 8 | msgstr "" 9 | "Project-Id-Version: Python for beginners\n" 10 | "Report-Msgid-Bugs-To: \n" 11 | "POT-Creation-Date: 2014-06-09 11:00+1000\n" 12 | "PO-Revision-Date: 2013-10-28 12:04+0000\n" 13 | "Last-Translator: sorrymak \n" 14 | "Language-Team: Russian (http://www.transifex.com/projects/p/python-for-beginners/language/ru/)\n" 15 | "MIME-Version: 1.0\n" 16 | "Content-Type: text/plain; charset=UTF-8\n" 17 | "Content-Transfer-Encoding: 8bit\n" 18 | "Language: ru\n" 19 | "Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" 20 | 21 | # ed81ac1143214436b0ac20d31a723e3e 22 | #: ../../../source/index.rst:2 23 | msgid "Introduction to Programming with Python" 24 | msgstr "Введение в программирование на Python" 25 | 26 | # db0c91bd12784cd0a6500ae9e9fd291c 27 | #: ../../../source/index.rst:6 28 | msgid "Table of contents:" 29 | msgstr "Содержание:" 30 | -------------------------------------------------------------------------------- /source/_templates/relations.html: -------------------------------------------------------------------------------- 1 | {%- if prev %} 2 | 8 | {%- endif %} 9 | {%- if next %} 10 | 16 | {%- endif %} 17 | 32 | -------------------------------------------------------------------------------- /source/locale/es_CL/LC_MESSAGES/index.po: -------------------------------------------------------------------------------- 1 | # SOME DESCRIPTIVE TITLE. 2 | # Copyright (C) 2012–2014, OpenTechSchool and contributors 3 | # This file is distributed under the same license as the Introduction to Programming with Python package. 4 | # 5 | # Translators: 6 | # Patricio Alejandro Urrutia Arestizábal , 2013 7 | msgid "" 8 | msgstr "" 9 | "Project-Id-Version: Python for beginners\n" 10 | "Report-Msgid-Bugs-To: \n" 11 | "POT-Creation-Date: 2014-06-09 11:00+1000\n" 12 | "PO-Revision-Date: 2013-10-30 14:48+0000\n" 13 | "Last-Translator: Patricio Alejandro Urrutia Arestizábal \n" 14 | "Language-Team: Spanish (Chile) (http://www.transifex.com/projects/p/python-for-beginners/language/es_CL/)\n" 15 | "MIME-Version: 1.0\n" 16 | "Content-Type: text/plain; charset=UTF-8\n" 17 | "Content-Transfer-Encoding: 8bit\n" 18 | "Language: es_CL\n" 19 | "Plural-Forms: nplurals=2; plural=(n != 1);\n" 20 | 21 | # ed81ac1143214436b0ac20d31a723e3e 22 | #: ../../../source/index.rst:2 23 | msgid "Introduction to Programming with Python" 24 | msgstr "Introducción a Programando con Python" 25 | 26 | # db0c91bd12784cd0a6500ae9e9fd291c 27 | #: ../../../source/index.rst:6 28 | msgid "Table of contents:" 29 | msgstr "Tabla de Contenidos" 30 | -------------------------------------------------------------------------------- /source/locale/de/LC_MESSAGES/index.po: -------------------------------------------------------------------------------- 1 | # SOME DESCRIPTIVE TITLE. 2 | # Copyright (C) 2012–2014, OpenTechSchool and contributors 3 | # This file is distributed under the same license as the Introduction to Programming with Python package. 4 | # 5 | # Translators: 6 | # Kristian Rother , 2013 7 | # Robert Lehmann , 2013 8 | # Benjamin Kampmann , 2013 9 | msgid "" 10 | msgstr "" 11 | "Project-Id-Version: Python for beginners\n" 12 | "Report-Msgid-Bugs-To: \n" 13 | "POT-Creation-Date: 2014-06-09 11:00+1000\n" 14 | "PO-Revision-Date: 2013-10-24 23:20+0000\n" 15 | "Last-Translator: Matthew Iversen \n" 16 | "Language-Team: German (http://www.transifex.com/projects/p/python-for-beginners/language/de/)\n" 17 | "MIME-Version: 1.0\n" 18 | "Content-Type: text/plain; charset=UTF-8\n" 19 | "Content-Transfer-Encoding: 8bit\n" 20 | "Language: de\n" 21 | "Plural-Forms: nplurals=2; plural=(n != 1);\n" 22 | 23 | # ed81ac1143214436b0ac20d31a723e3e 24 | #: ../../../source/index.rst:2 25 | msgid "Introduction to Programming with Python" 26 | msgstr "Programmiereinführung mit Python" 27 | 28 | # db0c91bd12784cd0a6500ae9e9fd291c 29 | #: ../../../source/index.rst:6 30 | msgid "Table of contents:" 31 | msgstr "Inhaltsverzeichnis:" 32 | -------------------------------------------------------------------------------- /source/_static/spoilers.js: -------------------------------------------------------------------------------- 1 | (function ($) { 2 | 'use strict'; 3 | $.fn.showHide = function (options) { 4 | 5 | //default vars for the plugin 6 | var defaults = { 7 | speed: 400, 8 | easing: 'swing', 9 | changeText: true, 10 | showText: 'Show', 11 | hideText: 'Hide' 12 | 13 | }; 14 | options = $.extend(defaults, options); 15 | 16 | var button = $(''); 17 | button.text(options.showText); 18 | button.data('el', $(this)); 19 | 20 | $(this).last().after(button); 21 | $(this).hide(); 22 | 23 | button.click(function () { 24 | var me = $(this); 25 | var el = me.data('el'); 26 | el.slideToggle(options.speed, options.easing, function() { 27 | if (options.changeText) { 28 | if (el.is(':visible')) { 29 | me.text(options.hideText); 30 | } else { 31 | me.text(options.showText); 32 | } 33 | } 34 | }); 35 | }); 36 | }; 37 | })(jQuery); 38 | 39 | (function ($) { 40 | $(document).ready(function() { 41 | 'use strict'; 42 | $('.solution h3').each(function() { 43 | $(this).nextAll().showHide(); 44 | }); 45 | }); 46 | })(jQuery); 47 | -------------------------------------------------------------------------------- /_static/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Introduction to programming with Python 6 | 37 | 38 | 39 | 40 |
41 |

Introduction to programming with Python

42 | 50 |
51 | 52 | 53 | -------------------------------------------------------------------------------- /.tx/config: -------------------------------------------------------------------------------- 1 | [main] 2 | host = https://www.transifex.com 3 | type = PO 4 | 5 | [python-for-beginners.conditional_loops] 6 | file_filter = source/locale//LC_MESSAGES/conditional_loops.po 7 | source_file = _build/locale/en/conditional_loops.pot 8 | source_lang = en 9 | 10 | [python-for-beginners.conditionals] 11 | file_filter = source/locale//LC_MESSAGES/conditionals.po 12 | source_file = _build/locale/en/conditionals.pot 13 | source_lang = en 14 | 15 | [python-for-beginners.copyright] 16 | file_filter = source/locale//LC_MESSAGES/copyright.po 17 | source_file = _build/locale/en/copyright.pot 18 | source_lang = en 19 | 20 | [python-for-beginners.functions_parameters] 21 | file_filter = source/locale//LC_MESSAGES/functions_parameters.po 22 | source_file = _build/locale/en/functions_parameters.pot 23 | source_lang = en 24 | 25 | [python-for-beginners.functions] 26 | file_filter = source/locale//LC_MESSAGES/functions.po 27 | source_file = _build/locale/en/functions.pot 28 | source_lang = en 29 | 30 | [python-for-beginners.getting_started] 31 | file_filter = source/locale//LC_MESSAGES/getting_started.po 32 | source_file = _build/locale/en/getting_started.pot 33 | source_lang = en 34 | 35 | [python-for-beginners.index] 36 | file_filter = source/locale//LC_MESSAGES/index.po 37 | source_file = _build/locale/en/index.pot 38 | source_lang = en 39 | 40 | [python-for-beginners.logical_operators] 41 | file_filter = source/locale//LC_MESSAGES/logical_operators.po 42 | source_file = _build/locale/en/logical_operators.pot 43 | source_lang = en 44 | 45 | [python-for-beginners.loops] 46 | file_filter = source/locale//LC_MESSAGES/loops.po 47 | source_file = _build/locale/en/loops.pot 48 | source_lang = en 49 | 50 | [python-for-beginners.simple_drawing] 51 | file_filter = source/locale//LC_MESSAGES/simple_drawing.po 52 | source_file = _build/locale/en/simple_drawing.pot 53 | source_lang = en 54 | 55 | [python-for-beginners.variables] 56 | file_filter = source/locale//LC_MESSAGES/variables.po 57 | source_file = _build/locale/en/variables.pot 58 | source_lang = en 59 | 60 | [python-for-beginners.where_to_go] 61 | file_filter = source/locale//LC_MESSAGES/where_to_go.po 62 | source_file = _build/locale/en/where_to_go.pot 63 | source_lang = en 64 | 65 | -------------------------------------------------------------------------------- /source/locale/ko/LC_MESSAGES/copyright.po: -------------------------------------------------------------------------------- 1 | # SOME DESCRIPTIVE TITLE. 2 | # Copyright (C) 2012–2014, OpenTechSchool and contributors 3 | # This file is distributed under the same license as the Introduction to Programming with Python package. 4 | # 5 | # Translators: 6 | # Seong-ho Cho , 2014 7 | msgid "" 8 | msgstr "" 9 | "Project-Id-Version: Python for beginners\n" 10 | "Report-Msgid-Bugs-To: \n" 11 | "POT-Creation-Date: 2015-10-02 06:32+1000\n" 12 | "PO-Revision-Date: 2015-10-01 20:36+0000\n" 13 | "Last-Translator: Matthew Iversen \n" 14 | "Language-Team: Korean (http://www.transifex.com/opentechschool/python-for-beginners/language/ko/)\n" 15 | "MIME-Version: 1.0\n" 16 | "Content-Type: text/plain; charset=UTF-8\n" 17 | "Content-Transfer-Encoding: 8bit\n" 18 | "Language: ko\n" 19 | "Plural-Forms: nplurals=1; plural=0;\n" 20 | 21 | #: ../../../source/copyright.rst:2 22 | msgid "License" 23 | msgstr "라이선스" 24 | 25 | #: ../../../source/copyright.rst:4 26 | msgid "" 27 | "This work is licensed under the Creative Commons Attribution-ShareAlike 3.0 " 28 | "Unported License. To view a copy of this license, visit " 29 | "http://creativecommons.org/licenses/by-sa/3.0/ or send a letter to Creative " 30 | "Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, " 31 | "USA." 32 | msgstr "이 작업물은 크리에이티브 커먼즈 저작자표시-동일조건변경허락 3.0 Unported 조항을 따릅니다. 이 라이선스 사본을 보려면 http://creativecommons.org/licenses/by-sa/3.0/ 주소를 방문하시거나 Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA에 서신을 보내주세요." 33 | 34 | #: ../../../source/copyright.rst:14 35 | msgid "Contributors" 36 | msgstr "" 37 | 38 | #: ../../../source/copyright.rst:16 39 | msgid "" 40 | "The following people have contributed to this material, in alphabetical " 41 | "order:" 42 | msgstr "" 43 | 44 | #: ../../../source/copyright.rst:29 45 | msgid "(This list is automatically generated from our `source repository`__.)" 46 | msgstr "" 47 | 48 | #: ../../../source/copyright.rst:33 49 | msgid "The material is legally maintained by" 50 | msgstr "" 51 | 52 | #: ../../../source/copyright.rst:0 53 | msgid "OpenTechSchool e.V." 54 | msgstr "" 55 | 56 | #: ../../../source/copyright.rst:0 57 | msgid "c/o co.up" 58 | msgstr "" 59 | 60 | #: ../../../source/copyright.rst:0 61 | msgid "Adalbertstr. 8" 62 | msgstr "" 63 | 64 | #: ../../../source/copyright.rst:0 65 | msgid "10999 Berlin, Germany" 66 | msgstr "" 67 | -------------------------------------------------------------------------------- /source/locale/de/LC_MESSAGES/copyright.po: -------------------------------------------------------------------------------- 1 | # SOME DESCRIPTIVE TITLE. 2 | # Copyright (C) 2012–2014, OpenTechSchool and contributors 3 | # This file is distributed under the same license as the Introduction to Programming with Python package. 4 | # 5 | # Translators: 6 | # Kristian Rother , 2013 7 | # Robert Lehmann , 2013 8 | # Benjamin Kampmann , 2013 9 | msgid "" 10 | msgstr "" 11 | "Project-Id-Version: Python for beginners\n" 12 | "Report-Msgid-Bugs-To: \n" 13 | "POT-Creation-Date: 2015-10-02 06:32+1000\n" 14 | "PO-Revision-Date: 2015-10-01 20:36+0000\n" 15 | "Last-Translator: Matthew Iversen \n" 16 | "Language-Team: German (http://www.transifex.com/opentechschool/python-for-beginners/language/de/)\n" 17 | "MIME-Version: 1.0\n" 18 | "Content-Type: text/plain; charset=UTF-8\n" 19 | "Content-Transfer-Encoding: 8bit\n" 20 | "Language: de\n" 21 | "Plural-Forms: nplurals=2; plural=(n != 1);\n" 22 | 23 | #: ../../../source/copyright.rst:2 24 | msgid "License" 25 | msgstr "Lizenz" 26 | 27 | #: ../../../source/copyright.rst:4 28 | msgid "" 29 | "This work is licensed under the Creative Commons Attribution-ShareAlike 3.0 " 30 | "Unported License. To view a copy of this license, visit " 31 | "http://creativecommons.org/licenses/by-sa/3.0/ or send a letter to Creative " 32 | "Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, " 33 | "USA." 34 | msgstr "Dieses Werk steht unter einer `Creative Commons Namensnennung - Weitergabe unter gleichen Bedingungen 3.0 Deutschland Lizenz `_." 35 | 36 | #: ../../../source/copyright.rst:14 37 | msgid "Contributors" 38 | msgstr "" 39 | 40 | #: ../../../source/copyright.rst:16 41 | msgid "" 42 | "The following people have contributed to this material, in alphabetical " 43 | "order:" 44 | msgstr "" 45 | 46 | #: ../../../source/copyright.rst:29 47 | msgid "(This list is automatically generated from our `source repository`__.)" 48 | msgstr "" 49 | 50 | #: ../../../source/copyright.rst:33 51 | msgid "The material is legally maintained by" 52 | msgstr "" 53 | 54 | #: ../../../source/copyright.rst:0 55 | msgid "OpenTechSchool e.V." 56 | msgstr "" 57 | 58 | #: ../../../source/copyright.rst:0 59 | msgid "c/o co.up" 60 | msgstr "" 61 | 62 | #: ../../../source/copyright.rst:0 63 | msgid "Adalbertstr. 8" 64 | msgstr "" 65 | 66 | #: ../../../source/copyright.rst:0 67 | msgid "10999 Berlin, Germany" 68 | msgstr "" 69 | -------------------------------------------------------------------------------- /source/locale/es_CL/LC_MESSAGES/copyright.po: -------------------------------------------------------------------------------- 1 | # SOME DESCRIPTIVE TITLE. 2 | # Copyright (C) 2012–2014, OpenTechSchool and contributors 3 | # This file is distributed under the same license as the Introduction to Programming with Python package. 4 | # 5 | # Translators: 6 | # Patricio Alejandro Urrutia Arestizábal , 2013 7 | msgid "" 8 | msgstr "" 9 | "Project-Id-Version: Python for beginners\n" 10 | "Report-Msgid-Bugs-To: \n" 11 | "POT-Creation-Date: 2015-10-02 06:32+1000\n" 12 | "PO-Revision-Date: 2015-10-01 20:36+0000\n" 13 | "Last-Translator: Matthew Iversen \n" 14 | "Language-Team: Spanish (Chile) (http://www.transifex.com/opentechschool/python-for-beginners/language/es_CL/)\n" 15 | "MIME-Version: 1.0\n" 16 | "Content-Type: text/plain; charset=UTF-8\n" 17 | "Content-Transfer-Encoding: 8bit\n" 18 | "Language: es_CL\n" 19 | "Plural-Forms: nplurals=2; plural=(n != 1);\n" 20 | 21 | #: ../../../source/copyright.rst:2 22 | msgid "License" 23 | msgstr "Licencia" 24 | 25 | #: ../../../source/copyright.rst:4 26 | msgid "" 27 | "This work is licensed under the Creative Commons Attribution-ShareAlike 3.0 " 28 | "Unported License. To view a copy of this license, visit " 29 | "http://creativecommons.org/licenses/by-sa/3.0/ or send a letter to Creative " 30 | "Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, " 31 | "USA." 32 | msgstr "Este trabajo está licenciado bajo la Creative Commons Attribution-ShareAlike 3.0 Unported License. Para ver una copia de la licencia, visite http://creativecommons.org/licenses/by-sa/3.0/ o envíe una carta a Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA." 33 | 34 | #: ../../../source/copyright.rst:14 35 | msgid "Contributors" 36 | msgstr "" 37 | 38 | #: ../../../source/copyright.rst:16 39 | msgid "" 40 | "The following people have contributed to this material, in alphabetical " 41 | "order:" 42 | msgstr "" 43 | 44 | #: ../../../source/copyright.rst:29 45 | msgid "(This list is automatically generated from our `source repository`__.)" 46 | msgstr "" 47 | 48 | #: ../../../source/copyright.rst:33 49 | msgid "The material is legally maintained by" 50 | msgstr "" 51 | 52 | #: ../../../source/copyright.rst:0 53 | msgid "OpenTechSchool e.V." 54 | msgstr "" 55 | 56 | #: ../../../source/copyright.rst:0 57 | msgid "c/o co.up" 58 | msgstr "" 59 | 60 | #: ../../../source/copyright.rst:0 61 | msgid "Adalbertstr. 8" 62 | msgstr "" 63 | 64 | #: ../../../source/copyright.rst:0 65 | msgid "10999 Berlin, Germany" 66 | msgstr "" 67 | -------------------------------------------------------------------------------- /source/logical_operators.rst: -------------------------------------------------------------------------------- 1 | Logical operators 2 | ***************** 3 | 4 | Introduction 5 | ============ 6 | 7 | Conditionals are a nice way to make decisions by asking if something equals 8 | *True* or not. But often one condition is not enough. 9 | We may want to take the opposite of our result. Or for instance if we want to 10 | make a decision upon ``turtle.xcor()`` and ``turtle.ycor()`` we have to combine 11 | them. This can be done with logical operators. 12 | 13 | Negation of a statement 14 | ======================= 15 | 16 | If we want something to be *False* we can use ``not``. It is a logical 17 | operator:: 18 | 19 | x = False 20 | if not x : 21 | print("condition met") 22 | else: 23 | print("condition not met") 24 | 25 | Exercise 26 | -------- 27 | 28 | The turtle gives us a useful function to know if it is drawing or not: 29 | ``turtle.isdown()``. This function returns *True* if the turtle is drawing. As 30 | we have seen earlier, the function ``turtle.penup()`` and ``turtle.pendown()`` 31 | toggle between drawing while moving, or just moving without a trace. 32 | 33 | Can we write a function that only goes forward if the pen is up? 34 | 35 | .. rst-class:: solution 36 | 37 | Solution 38 | -------- 39 | 40 | :: 41 | 42 | def stealthed_forward(distance): 43 | if not turtle.isdown(): 44 | turtle.forward(distance) 45 | 46 | 47 | This and that or something else 48 | =============================== 49 | 50 | Two easy to understand operators are ``and`` and ``or``. They do exactly what 51 | they sound like::: 52 | 53 | if 1 < 2 and 4 > 2: 54 | print("condition met") 55 | 56 | if 1 > 2 and 4 < 10: 57 | print("condition not met") 58 | 59 | if 4 < 10 or 1 < 2: 60 | print("condition met") 61 | 62 | You are not restricted to one logical operator. You can combine as may as you 63 | want. 64 | 65 | Exercise 66 | -------- 67 | 68 | Earlier we put the turtle in a circular prison. This time let's make 69 | it a box. If the turtle goes more than 100 in the X *or* Y axis then 70 | we turn the turtle back around to the center. 71 | 72 | .. rst-class:: solution 73 | 74 | Solution 75 | -------- 76 | 77 | :: 78 | 79 | def forward(distance): 80 | while distance > 0: 81 | if (turtle.xcor() > 100 82 | or turtle.xcor() < -100 83 | or turtle.ycor() > 100 84 | or turtle.ycor() < -100): 85 | turtle.setheading(turtle.towards(0,0)) 86 | turtle.forward(1) 87 | distance = distance - 1 88 | -------------------------------------------------------------------------------- /source/locale/ro/LC_MESSAGES/copyright.po: -------------------------------------------------------------------------------- 1 | # SOME DESCRIPTIVE TITLE. 2 | # Copyright (C) 2012–2014, OpenTechSchool and contributors 3 | # This file is distributed under the same license as the Introduction to Programming with Python package. 4 | # 5 | # Translators: 6 | # Razvan Stefanescu , 2015 7 | msgid "" 8 | msgstr "" 9 | "Project-Id-Version: Python for beginners\n" 10 | "Report-Msgid-Bugs-To: \n" 11 | "POT-Creation-Date: 2015-10-02 06:32+1000\n" 12 | "PO-Revision-Date: 2015-10-01 20:36+0000\n" 13 | "Last-Translator: Matthew Iversen \n" 14 | "Language-Team: Romanian (http://www.transifex.com/opentechschool/python-for-beginners/language/ro/)\n" 15 | "MIME-Version: 1.0\n" 16 | "Content-Type: text/plain; charset=UTF-8\n" 17 | "Content-Transfer-Encoding: 8bit\n" 18 | "Language: ro\n" 19 | "Plural-Forms: nplurals=3; plural=(n==1?0:(((n%100>19)||((n%100==0)&&(n!=0)))?2:1));\n" 20 | 21 | #: ../../../source/copyright.rst:2 22 | msgid "License" 23 | msgstr "Licență" 24 | 25 | #: ../../../source/copyright.rst:4 26 | msgid "" 27 | "This work is licensed under the Creative Commons Attribution-ShareAlike 3.0 " 28 | "Unported License. To view a copy of this license, visit " 29 | "http://creativecommons.org/licenses/by-sa/3.0/ or send a letter to Creative " 30 | "Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, " 31 | "USA." 32 | msgstr "Acest document teste licențiat sub Creative Commons Attribution-ShareAlike 3.0 Unported License. Pentru a vedea o copie a acestei licențe, vizitează http://creativecommons.org/licenses/by-sa/3.0/ sau trimite o scrisoare la Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA." 33 | 34 | #: ../../../source/copyright.rst:14 35 | msgid "Contributors" 36 | msgstr "" 37 | 38 | #: ../../../source/copyright.rst:16 39 | msgid "" 40 | "The following people have contributed to this material, in alphabetical " 41 | "order:" 42 | msgstr "" 43 | 44 | #: ../../../source/copyright.rst:29 45 | msgid "(This list is automatically generated from our `source repository`__.)" 46 | msgstr "" 47 | 48 | #: ../../../source/copyright.rst:33 49 | msgid "The material is legally maintained by" 50 | msgstr "" 51 | 52 | #: ../../../source/copyright.rst:0 53 | msgid "OpenTechSchool e.V." 54 | msgstr "" 55 | 56 | #: ../../../source/copyright.rst:0 57 | msgid "c/o co.up" 58 | msgstr "" 59 | 60 | #: ../../../source/copyright.rst:0 61 | msgid "Adalbertstr. 8" 62 | msgstr "" 63 | 64 | #: ../../../source/copyright.rst:0 65 | msgid "10999 Berlin, Germany" 66 | msgstr "" 67 | -------------------------------------------------------------------------------- /source/locale/ru/LC_MESSAGES/copyright.po: -------------------------------------------------------------------------------- 1 | # SOME DESCRIPTIVE TITLE. 2 | # Copyright (C) 2012–2014, OpenTechSchool and contributors 3 | # This file is distributed under the same license as the Introduction to Programming with Python package. 4 | # 5 | # Translators: 6 | # sorrymak , 2013 7 | msgid "" 8 | msgstr "" 9 | "Project-Id-Version: Python for beginners\n" 10 | "Report-Msgid-Bugs-To: \n" 11 | "POT-Creation-Date: 2015-10-02 06:32+1000\n" 12 | "PO-Revision-Date: 2015-10-01 20:36+0000\n" 13 | "Last-Translator: Matthew Iversen \n" 14 | "Language-Team: Russian (http://www.transifex.com/opentechschool/python-for-beginners/language/ru/)\n" 15 | "MIME-Version: 1.0\n" 16 | "Content-Type: text/plain; charset=UTF-8\n" 17 | "Content-Transfer-Encoding: 8bit\n" 18 | "Language: ru\n" 19 | "Plural-Forms: nplurals=4; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<12 || n%100>14) ? 1 : n%10==0 || (n%10>=5 && n%10<=9) || (n%100>=11 && n%100<=14)? 2 : 3);\n" 20 | 21 | #: ../../../source/copyright.rst:2 22 | msgid "License" 23 | msgstr "Лицензия" 24 | 25 | #: ../../../source/copyright.rst:4 26 | msgid "" 27 | "This work is licensed under the Creative Commons Attribution-ShareAlike 3.0 " 28 | "Unported License. To view a copy of this license, visit " 29 | "http://creativecommons.org/licenses/by-sa/3.0/ or send a letter to Creative " 30 | "Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, " 31 | "USA." 32 | msgstr "Эта работа распространяется под Creative Commons Attribution-ShareAlike 3.0 Unported License. Чтобы просмотреть копию этой лицензии, зайди на http://creativecommons.org/licenses/by-sa/3.0/ или отправь письмо в Creative Commons: 444 Castro Street, Suite 900, Mountain View, California, 94041, USA." 33 | 34 | #: ../../../source/copyright.rst:14 35 | msgid "Contributors" 36 | msgstr "" 37 | 38 | #: ../../../source/copyright.rst:16 39 | msgid "" 40 | "The following people have contributed to this material, in alphabetical " 41 | "order:" 42 | msgstr "" 43 | 44 | #: ../../../source/copyright.rst:29 45 | msgid "(This list is automatically generated from our `source repository`__.)" 46 | msgstr "" 47 | 48 | #: ../../../source/copyright.rst:33 49 | msgid "The material is legally maintained by" 50 | msgstr "" 51 | 52 | #: ../../../source/copyright.rst:0 53 | msgid "OpenTechSchool e.V." 54 | msgstr "" 55 | 56 | #: ../../../source/copyright.rst:0 57 | msgid "c/o co.up" 58 | msgstr "" 59 | 60 | #: ../../../source/copyright.rst:0 61 | msgid "Adalbertstr. 8" 62 | msgstr "" 63 | 64 | #: ../../../source/copyright.rst:0 65 | msgid "10999 Berlin, Germany" 66 | msgstr "" 67 | -------------------------------------------------------------------------------- /source/_static/custom.css: -------------------------------------------------------------------------------- 1 | @font-face { 2 | font-family: 'Montserrat'; 3 | font-style: normal; 4 | font-weight: 400; 5 | src: local('Montserrat-Regular'), url(http://themes.googleusercontent.com/static/fonts/montserrat/v3/zhcz-_WihjSQC0oHJ9TCYBsxEYwM7FgeyaSgU71cLG0.woff) format('woff'); 6 | } 7 | @font-face { 8 | font-family: 'Montserrat'; 9 | font-style: normal; 10 | font-weight: 700; 11 | src: local('Montserrat-Bold'), url(http://themes.googleusercontent.com/static/fonts/montserrat/v3/IQHow_FEYlDC4Gzy_m8fcgFhaRv2pGgT5Kf0An0s4MM.woff) format('woff'); 12 | } 13 | @font-face { 14 | font-family: 'Open Sans'; 15 | font-style: normal; 16 | font-weight: 400; 17 | src: local('Open Sans'), local('OpenSans'), url(http://themes.googleusercontent.com/static/fonts/opensans/v6/cJZKeOuBrn4kERxqtaUH3T8E0i7KZn-EPnyo3HZu7kw.woff) format('woff'); 18 | } 19 | @font-face { 20 | font-family: 'Open Sans'; 21 | font-style: normal; 22 | font-weight: 700; 23 | src: local('Open Sans Bold'), local('OpenSans-Bold'), url(http://themes.googleusercontent.com/static/fonts/opensans/v6/k3k702ZOKiLJc3WVjuplzHhCUOGz7vYGh680lGh-uXM.woff) format('woff'); 24 | } 25 | @font-face { 26 | font-family: 'Open Sans'; 27 | font-style: italic; 28 | font-weight: 400; 29 | src: local('Open Sans Italic'), local('OpenSans-Italic'), url(http://themes.googleusercontent.com/static/fonts/opensans/v6/xjAJXh38I15wypJXxuGMBobN6UDyHWBl620a-IRfuBk.woff) format('woff'); 30 | } 31 | @font-face { 32 | font-family: 'Source Code Pro'; 33 | font-style: normal; 34 | font-weight: 400; 35 | src: local('Source Code Pro'), local('SourceCodePro-Regular'), url(http://themes.googleusercontent.com/static/fonts/sourcecodepro/v3/mrl8jkM18OlOQN8JLgasDxM0YzuT7MdOe03otPbuUS0.woff) format('woff'); 36 | } 37 | div.body h1, 38 | div.body h2, 39 | div.body h3, 40 | div.body h4, 41 | div.body h5, 42 | div.body h6 { 43 | font-family: Montserrat, sans-serif; 44 | } 45 | body { 46 | font-family: 'Open Sans', sans-serif; 47 | } 48 | pre { 49 | font-family: 'Source Code Pro', monospace; 50 | font-size: 1em; 51 | } 52 | div.sphinxsidebar { 53 | font-size: 0.8em; 54 | } 55 | div.related { 56 | background-color: #085987; 57 | } 58 | div.related a { 59 | color: white; 60 | } 61 | .navbar-version b { 62 | font-weight: lighter; 63 | color: #76B3D6; 64 | } 65 | .navbar-version b:before { 66 | content: "v"; 67 | } 68 | .navbar-rel .glyphicon { 69 | font-size: 0.9em; 70 | } 71 | #navbar { 72 | background-image: linear-gradient(to bottom, #085987 0px, #2fb0d5 100%); 73 | } 74 | .navbar>.container .navbar-brand, 75 | .navbar-default .navbar-nav>li>a { 76 | color: white !important; 77 | } 78 | .navbar-default .navbar-nav>.open>a, 79 | .navbar-default .navbar-nav>.open>a:hover, 80 | .navbar-default .navbar-nav>.open>a:focus { 81 | background-color: #1F8AB6 !important; 82 | } 83 | footer { 84 | margin-top: 1em; 85 | } 86 | -------------------------------------------------------------------------------- /source/variables.rst: -------------------------------------------------------------------------------- 1 | Variables 2 | ********* 3 | 4 | Introduction 5 | ============ 6 | 7 | Whew. Experimenting with the angles requires you to change three different 8 | places in the code each time. Imagine you'd want to experiment with 9 | all of the square sizes, let alone with rectangles! We can do better than that. 10 | 11 | This is where **variables** come into play: You can tell Python that from now on, 12 | whenever you refer to a variable, you actually mean something else. That concept 13 | might be familiar from symbolic maths, where you would write: *Let x be 5.* 14 | Then *x \* 2* will obviously be *10*. 15 | 16 | In Python syntax, that very statement translates to:: 17 | 18 | x = 5 19 | 20 | After that statement, if you do ``print(x)``, it will actually output its value 21 | --- 5. Well, can use that for your turtle too:: 22 | 23 | turtle.forward(x) 24 | 25 | Variables can store all sorts of things, not just numbers. A typical 26 | other thing you want to have stored often is a **string** - a line of text. 27 | Strings are indicated with a starting and a leading ``"`` (double quote). 28 | You'll learn about this and other types, as those are called in Python, and 29 | what you can do with them later on. 30 | 31 | You can even use a variable to give the turtle a name:: 32 | 33 | timmy = turtle 34 | 35 | Now every time you type ``timmy`` it knows you mean ``turtle``. You can 36 | still continue to use ``turtle`` as well:: 37 | 38 | timmy.forward(50) 39 | timmy.left(90) 40 | turtle.forward(50) 41 | 42 | A variable called angle 43 | ======================= 44 | 45 | Exercise 46 | -------- 47 | 48 | If we have a variable called ``angle``, how could we use that to experiment 49 | much faster with our tilted squares program? 50 | 51 | .. rst-class:: solution 52 | 53 | Solution 54 | -------- 55 | 56 | :: 57 | 58 | angle = 20 59 | 60 | turtle.left(angle) 61 | 62 | turtle.forward(50) 63 | turtle.left(90) 64 | turtle.forward(50) 65 | turtle.left(90) 66 | turtle.forward(50) 67 | turtle.left(90) 68 | turtle.forward(50) 69 | turtle.left(90) 70 | 71 | turtle.left(angle) 72 | 73 | 74 | ... and so on 75 | 76 | Bonus 77 | ----- 78 | 79 | Can you apply that principle to the size of the squares, too? 80 | 81 | The house of santa claus 82 | ======================== 83 | 84 | Exercise 85 | -------- 86 | 87 | Draw a house. 88 | 89 | .. image:: /images/house.png 90 | 91 | You can calculate the length of the diagonal line with the Pythagorean 92 | theorem. That value is a good candidate to store in a variable. To calculate 93 | the square root of a number in Python, you'll need to import the *math* module 94 | and use the ``math.sqrt()`` function. The square of a number is calculated 95 | with the ``**`` operator:: 96 | 97 | import math 98 | 99 | c = math.sqrt(a**2 + b**2) 100 | 101 | -------------------------------------------------------------------------------- /source/locale/en/LC_MESSAGES/logical_operators.po: -------------------------------------------------------------------------------- 1 | # 2 | msgid "" 3 | msgstr "" 4 | "Project-Id-Version: Introduction to Programming with Python 0.1\n" 5 | "Report-Msgid-Bugs-To: \n" 6 | "POT-Creation-Date: 2013-10-25 09:37\n" 7 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 8 | "Last-Translator: FULL NAME \n" 9 | "Language-Team: LANGUAGE \n" 10 | "MIME-Version: 1.0\n" 11 | "Content-Type: text/plain; charset=UTF-8\n" 12 | "Content-Transfer-Encoding: 8bit\n" 13 | 14 | #: ../../../source/logical_operators.rst:2 15 | msgid "Logical operators" 16 | msgstr "" 17 | 18 | #: ../../../source/logical_operators.rst:5 19 | msgid "Introduction" 20 | msgstr "" 21 | 22 | #: ../../../source/logical_operators.rst:7 23 | msgid "" 24 | "Conditionals are a nice way to make decisions by asking if something equals " 25 | "*True* or not. But often one condition is not enough. We may want to take " 26 | "the opposite of our result. Or for instance if we want to make a decision " 27 | "upon ``turtle.xcor()`` and ``turtle.ycor()`` we have to combine them. This " 28 | "can be done with logical operators." 29 | msgstr "" 30 | 31 | #: ../../../source/logical_operators.rst:14 32 | msgid "Negation of a statement" 33 | msgstr "" 34 | 35 | #: ../../../source/logical_operators.rst:16 36 | msgid "" 37 | "If we want something to be *False* we can use ``not``. It is a logical " 38 | "operator::" 39 | msgstr "" 40 | 41 | #: ../../../source/logical_operators.rst:26 42 | #: ../../../source/logical_operators.rst:64 43 | msgid "Exercise" 44 | msgstr "" 45 | 46 | #: ../../../source/logical_operators.rst:28 47 | msgid "" 48 | "The turtle gives us a useful function to know if it is drawing or not: " 49 | "``turtle.isdown()``. This function returns *True* if the turtle is drawing." 50 | " As we have seen earlier, the function ``turtle.penup()`` and " 51 | "``turtle.pendown()`` toggle between drawing while moving, or just moving " 52 | "without a trace." 53 | msgstr "" 54 | 55 | #: ../../../source/logical_operators.rst:33 56 | msgid "Can we write a function that only goes forward if the pen is up?" 57 | msgstr "" 58 | 59 | #: ../../../source/logical_operators.rst:36 60 | #: ../../../source/logical_operators.rst:71 61 | msgid "Solution" 62 | msgstr "" 63 | 64 | #: ../../../source/logical_operators.rst:46 65 | msgid "This and that or something else" 66 | msgstr "" 67 | 68 | #: ../../../source/logical_operators.rst:48 69 | msgid "" 70 | "Two easy to understand operators are ``and`` and ``or``. They do exactly " 71 | "what they sound like:::" 72 | msgstr "" 73 | 74 | #: ../../../source/logical_operators.rst:60 75 | msgid "" 76 | "You are not restricted to one logical operator. You can combine as may as " 77 | "you want." 78 | msgstr "" 79 | 80 | #: ../../../source/logical_operators.rst:66 81 | msgid "" 82 | "Earlier we put the turtle in a circular prison. This time let's make it a " 83 | "box. If the turtle goes more than 100 in the X *or* Y axis then we turn the " 84 | "turtle back around to the center." 85 | msgstr "" 86 | -------------------------------------------------------------------------------- /source/locale/fr/LC_MESSAGES/logical_operators.po: -------------------------------------------------------------------------------- 1 | # 2 | msgid "" 3 | msgstr "" 4 | "Project-Id-Version: Introduction to Programming with Python 0.1\n" 5 | "Report-Msgid-Bugs-To: \n" 6 | "POT-Creation-Date: 2013-10-25 09:14\n" 7 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 8 | "Last-Translator: FULL NAME \n" 9 | "Language-Team: LANGUAGE \n" 10 | "MIME-Version: 1.0\n" 11 | "Content-Type: text/plain; charset=UTF-8\n" 12 | "Content-Transfer-Encoding: 8bit\n" 13 | 14 | #: ../../../source/logical_operators.rst:2 15 | msgid "Logical operators" 16 | msgstr "" 17 | 18 | #: ../../../source/logical_operators.rst:5 19 | msgid "Introduction" 20 | msgstr "" 21 | 22 | #: ../../../source/logical_operators.rst:7 23 | msgid "" 24 | "Conditionals are a nice way to make decisions by asking if something equals " 25 | "*True* or not. But often one condition is not enough. We may want to take " 26 | "the opposite of our result. Or for instance if we want to make a decision " 27 | "upon ``turtle.xcor()`` and ``turtle.ycor()`` we have to combine them. This " 28 | "can be done with logical operators." 29 | msgstr "" 30 | 31 | #: ../../../source/logical_operators.rst:14 32 | msgid "Negation of a statement" 33 | msgstr "" 34 | 35 | #: ../../../source/logical_operators.rst:16 36 | msgid "" 37 | "If we want something to be *False* we can use ``not``. It is a logical " 38 | "operator::" 39 | msgstr "" 40 | 41 | #: ../../../source/logical_operators.rst:26 42 | #: ../../../source/logical_operators.rst:64 43 | msgid "Exercise" 44 | msgstr "" 45 | 46 | #: ../../../source/logical_operators.rst:28 47 | msgid "" 48 | "The turtle gives us a useful function to know if it is drawing or not: " 49 | "``turtle.isdown()``. This function returns *True* if the turtle is drawing." 50 | " As we have seen earlier, the function ``turtle.penup()`` and " 51 | "``turtle.pendown()`` toggle between drawing while moving, or just moving " 52 | "without a trace." 53 | msgstr "" 54 | 55 | #: ../../../source/logical_operators.rst:33 56 | msgid "Can we write a function that only goes forward if the pen is up?" 57 | msgstr "" 58 | 59 | #: ../../../source/logical_operators.rst:36 60 | #: ../../../source/logical_operators.rst:71 61 | msgid "Solution" 62 | msgstr "" 63 | 64 | #: ../../../source/logical_operators.rst:46 65 | msgid "This and that or something else" 66 | msgstr "" 67 | 68 | #: ../../../source/logical_operators.rst:48 69 | msgid "" 70 | "Two easy to understand operators are ``and`` and ``or``. They do exactly " 71 | "what they sound like:::" 72 | msgstr "" 73 | 74 | #: ../../../source/logical_operators.rst:60 75 | msgid "" 76 | "You are not restricted to one logical operator. You can combine as may as " 77 | "you want." 78 | msgstr "" 79 | 80 | #: ../../../source/logical_operators.rst:66 81 | msgid "" 82 | "Earlier we put the turtle in a circular prison. This time let's make it a " 83 | "box. If the turtle goes more than 100 in the X *or* Y axis then we turn the " 84 | "turtle back around to the center." 85 | msgstr "" 86 | -------------------------------------------------------------------------------- /source/functions_parameters.rst: -------------------------------------------------------------------------------- 1 | Functions with parameters 2 | ************************* 3 | 4 | Introduction 5 | ============ 6 | 7 | As we shrink down our code and add functions to remove duplication, we 8 | are *factorizing* it. This is a good thing to do. But the functions we 9 | have defined so far are not very flexible. The variables are defined 10 | inside the function, so if we want to use a different angle or a 11 | distance then we need to write a new function. Our hexagon function can 12 | only draw one size of hexagon! 13 | 14 | That is why we need to be able to give parameters, also called 15 | *arguments*, to the function. This way the *variables* in the 16 | function can have different values each time we call the function: 17 | 18 | Remember how we defined the function ``line_without_moving()`` in the previous 19 | section:: 20 | 21 | def line_without_moving(): 22 | turtle.forward(50) 23 | turtle.backward(50) 24 | 25 | We can improve it by giving it a parameter:: 26 | 27 | def line_without_moving(length): 28 | turtle.forward(length) 29 | turtle.backward(length) 30 | 31 | The parameter acts as a *variable* only known inside the function's definition. 32 | We use the newly defined function by calling it with the value we want the 33 | parameter to have like this:: 34 | 35 | line_without_moving(50) 36 | line_without_moving(40) 37 | 38 | We have been using functions with parameters since the beginning of the 39 | tutorial with ``turtle.forward()``, ``turtle.left()``, etc... 40 | 41 | And we can put as many arguments (or parameters) as we want, separating them 42 | with commas and giving them different names:: 43 | 44 | def tilted_line_without_moving(length, angle): 45 | turtle.left(angle) 46 | turtle.forward(length) 47 | turtle.backward(length) 48 | 49 | A parameterized function for a variable size hexagon 50 | ==================================================== 51 | 52 | Exercise 53 | -------- 54 | 55 | Write a function that allows you to draw hexagons of any size you want, each 56 | time you call the function. 57 | 58 | .. rst-class:: solution 59 | 60 | Solution 61 | -------- 62 | 63 | :: 64 | 65 | def hexagon(size): 66 | for _ in range(6): 67 | turtle.forward(size) 68 | turtle.left(60) 69 | 70 | A function of several parameters 71 | ================================ 72 | 73 | Exercise 74 | -------- 75 | 76 | Write a function that will draw a shape of *any* number of sides (let's assume 77 | greater than two) of any side length. Get it to draw some different shapes. 78 | 79 | Here's an example of drawing shapes with this function: 80 | 81 | .. image:: /images/shapes.png 82 | 83 | .. tip:: 84 | 85 | The sum of the external angles of any shape is always 360 degrees! 86 | 87 | .. rst-class:: solution 88 | 89 | Solution 90 | -------- 91 | 92 | :: 93 | 94 | def draw_shape(sides, length): 95 | for _ in range(sides): 96 | turtle.forward(length) 97 | turtle.right(360 / sides) 98 | 99 | Bonus 100 | ----- 101 | 102 | It might sound crazy, but it's perfectly possible to pass a *function* as a parameter 103 | to another function! Python regards functions as perfectly normal 'things', the same as 104 | variables, numbers and strings. 105 | 106 | For instance, you could create a shape drawing function which turned one way or another 107 | depending on which turtle function you passed to it - ``turtle.left`` or ``turtle.right``. 108 | 109 | See if you can implement this! 110 | 111 | .. note:: 112 | 113 | Passing a function (e.g ``turtle.left``) is different than *calling* it, which 114 | would instead be written ``turtle.left(45)``. 115 | -------------------------------------------------------------------------------- /source/conditionals.rst: -------------------------------------------------------------------------------- 1 | Conditional statements 2 | ********************** 3 | 4 | Introduction 5 | ============ 6 | 7 | So far we have accomplished predefined tasks, but in all honesty we 8 | were accomplishing no better than old-time music boxes following one 9 | set of instructions to the end. What makes programming so much more 10 | powerful are conditional statements. This is the ability to *test* a 11 | variable against a value and act in one way if the condition is met by 12 | the variable or another way if not. They are also commonly called by 13 | programmers *if statements*. 14 | 15 | To know if a condition is *True* of *False*, we need a new type of data: 16 | the booleans. They allow logical operations. 17 | A logic statement or operation can be evaluated to be *True* or *False*. 18 | Our conditional statement can then be understood like this: 19 | 20 | **if** *(a condition evaluates to True)*: 21 | *then do these things only for 'True'* 22 | **else**: 23 | *otherwise do these things only for 'False'*. 24 | 25 | The condition can be anything that evaluates as *True* or 26 | *False*. Comparisons always return *True* or *False*, for example 27 | ``==`` (equal to), ``>`` (greater than), ``<`` (less than.) 28 | 29 | The **else** part is optional. If you leave it off, nothing will 30 | happen if the conditional evaluates to 'False'. 31 | 32 | 33 | Examples 34 | ======== 35 | 36 | Here are some examples. You may want to read them over line-by-line 37 | and see what you think they do, or run them to be certain:: 38 | 39 | condition = True 40 | if condition: 41 | print("condition met") 42 | 43 | if not condition: 44 | print("condition not met") 45 | 46 | direction = -30 47 | if direction > 0 : 48 | turtle.forward(direction) 49 | else: 50 | turtle.left(180) 51 | turtle.forward(-direction) 52 | 53 | Giving Directions 54 | ================= 55 | 56 | Python turtles can be very good at following instructions. Let's use 57 | the ``input()`` function to ask the user for a direction to move 58 | the turtle. To keep things easy we will only accept two instructions: 59 | "left" and "right". 60 | 61 | .. note:: 62 | 63 | Using Python 2? The ``input()`` function is called ``raw_input()``. 64 | 65 | It's much easier to define this as a function, like so:: 66 | 67 | def move(): 68 | direction = input("Go left or right? ") 69 | if direction == "left": 70 | turtle.left(60) 71 | turtle.forward(50) 72 | if direction == "right": 73 | turtle.right(60) 74 | turtle.forward(50) 75 | 76 | Now whenever you use ``move()`` you are prompted to choose ``left`` or 77 | ``right``. 78 | 79 | 80 | "data munging" 81 | ============== 82 | 83 | In this program, the turtle will only respond to exactly ``left`` 84 | or ``right`` with no variation. Though ``Left`` or ``LEFT`` might 85 | seem the same as ``left`` to a human, that isn't the case when programming. Python 86 | has a few utility methods to help with that. A string has the methods 87 | ``.strip()``, which removes whitespace and ``.lower()`` which makes 88 | everything lower-case. 89 | 90 | Here are some examples to print out the effects of ``.strip()`` and ``.lower()``:: 91 | 92 | my_variable = " I Am Capitalised" 93 | print(my_variable) 94 | my_stripped = my_variable.strip() 95 | print(my_stripped) 96 | my_lower = my_variable.lower() 97 | print(my_lower) 98 | 99 | Try adding ``direction = direction.strip().lower()`` to the ``move()`` 100 | function, to see the effect. We often call this kind of code "data 101 | munging", and it is very common. 102 | 103 | Can you add some extra input choices to make the turtle draw other 104 | things? How about ``hexagon``? 105 | -------------------------------------------------------------------------------- /source/locale/en/LC_MESSAGES/variables.po: -------------------------------------------------------------------------------- 1 | # 2 | msgid "" 3 | msgstr "" 4 | "Project-Id-Version: Introduction to Programming with Python 0.1\n" 5 | "Report-Msgid-Bugs-To: \n" 6 | "POT-Creation-Date: 2013-10-25 09:37\n" 7 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 8 | "Last-Translator: FULL NAME \n" 9 | "Language-Team: LANGUAGE \n" 10 | "MIME-Version: 1.0\n" 11 | "Content-Type: text/plain; charset=UTF-8\n" 12 | "Content-Transfer-Encoding: 8bit\n" 13 | 14 | #: ../../../source/variables.rst:2 15 | msgid "Variables" 16 | msgstr "" 17 | 18 | #: ../../../source/variables.rst:5 19 | msgid "Introduction" 20 | msgstr "" 21 | 22 | #: ../../../source/variables.rst:7 23 | msgid "" 24 | "Whew. Experimenting with the angles requires you to change three different " 25 | "places in the code each time. Imagine you'd want to experiment with all of " 26 | "the square sizes, let alone with rectangles! We can do better than that." 27 | msgstr "" 28 | 29 | #: ../../../source/variables.rst:11 30 | msgid "" 31 | "This is where **variables** come into play: You can tell Python that from " 32 | "now on, whenever you refer to a variable, you actually mean something else. " 33 | "That concept might be familiar from symbolic maths, where you would write: " 34 | "*Let x be 5.* Then *x \\* 2* will obviously be *10*." 35 | msgstr "" 36 | 37 | #: ../../../source/variables.rst:16 38 | msgid "In Python syntax, that very statement translates to::" 39 | msgstr "" 40 | 41 | #: ../../../source/variables.rst:20 42 | msgid "" 43 | "After that statement, if you do ``print(x)``, it will actually output its " 44 | "value --- 5. Well, can use that for your turtle too::" 45 | msgstr "" 46 | 47 | #: ../../../source/variables.rst:25 48 | msgid "" 49 | "Variables can store all sorts of things, not just numbers. A typical other " 50 | "thing you want to have stored often is a **string** - a line of text. " 51 | "Strings are indicated with a starting and a leading ``\"`` (double quote). " 52 | "You'll learn about this and other types, as those are called in Python, and " 53 | "what you can do with them later on." 54 | msgstr "" 55 | 56 | #: ../../../source/variables.rst:31 57 | msgid "You can even use a variable to give the turtle a name::" 58 | msgstr "" 59 | 60 | #: ../../../source/variables.rst:35 61 | msgid "" 62 | "Now every time you type ``timmy`` it knows you mean ``turtle``. You can " 63 | "still continue to use ``turtle`` as well::" 64 | msgstr "" 65 | 66 | #: ../../../source/variables.rst:43 67 | msgid "A variable called angle" 68 | msgstr "" 69 | 70 | #: ../../../source/variables.rst:46 ../../../source/variables.rst:83 71 | msgid "Exercise" 72 | msgstr "" 73 | 74 | #: ../../../source/variables.rst:48 75 | msgid "" 76 | "If we have a variable called ``angle``, how could we use that to experiment " 77 | "much faster with our tilted squares program?" 78 | msgstr "" 79 | 80 | #: ../../../source/variables.rst:52 81 | msgid "Solution" 82 | msgstr "" 83 | 84 | #: ../../../source/variables.rst:72 85 | msgid "... and so on" 86 | msgstr "" 87 | 88 | #: ../../../source/variables.rst:75 89 | msgid "Bonus" 90 | msgstr "" 91 | 92 | #: ../../../source/variables.rst:77 93 | msgid "Can you apply that principle to the size of the squares, too?" 94 | msgstr "" 95 | 96 | #: ../../../source/variables.rst:80 97 | msgid "The house of santa claus" 98 | msgstr "" 99 | 100 | #: ../../../source/variables.rst:85 101 | msgid "Draw a house." 102 | msgstr "" 103 | 104 | #: ../../../source/variables.rst:89 105 | msgid "" 106 | "You can calculate the length of the diagonal line with the Pythagorean " 107 | "theorem. That value is a good candidate to store in a variable. To calculate" 108 | " the square root of a number in Python, you'll need to import the *math* " 109 | "module and use the ``math.sqrt()`` function. The square of a number is " 110 | "calculated with the ``**`` operator::" 111 | msgstr "" 112 | -------------------------------------------------------------------------------- /source/locale/fr/LC_MESSAGES/variables.po: -------------------------------------------------------------------------------- 1 | # 2 | msgid "" 3 | msgstr "" 4 | "Project-Id-Version: Introduction to Programming with Python 0.1\n" 5 | "Report-Msgid-Bugs-To: \n" 6 | "POT-Creation-Date: 2013-10-25 09:14\n" 7 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 8 | "Last-Translator: FULL NAME \n" 9 | "Language-Team: LANGUAGE \n" 10 | "MIME-Version: 1.0\n" 11 | "Content-Type: text/plain; charset=UTF-8\n" 12 | "Content-Transfer-Encoding: 8bit\n" 13 | 14 | #: ../../../source/variables.rst:2 15 | msgid "Variables" 16 | msgstr "" 17 | 18 | #: ../../../source/variables.rst:5 19 | msgid "Introduction" 20 | msgstr "" 21 | 22 | #: ../../../source/variables.rst:7 23 | msgid "" 24 | "Whew. Experimenting with the angles requires you to change three different " 25 | "places in the code each time. Imagine you'd want to experiment with all of " 26 | "the square sizes, let alone with rectangles! We can do better than that." 27 | msgstr "" 28 | 29 | #: ../../../source/variables.rst:11 30 | msgid "" 31 | "This is where **variables** come into play: You can tell Python that from " 32 | "now on, whenever you refer to a variable, you actually mean something else. " 33 | "That concept might be familiar from symbolic maths, where you would write: " 34 | "*Let x be 5.* Then *x \\* 2* will obviously be *10*." 35 | msgstr "" 36 | 37 | #: ../../../source/variables.rst:16 38 | msgid "In Python syntax, that very statement translates to::" 39 | msgstr "" 40 | 41 | #: ../../../source/variables.rst:20 42 | msgid "" 43 | "After that statement, if you do ``print(x)``, it will actually output its " 44 | "value --- 5. Well, can use that for your turtle too::" 45 | msgstr "" 46 | 47 | #: ../../../source/variables.rst:25 48 | msgid "" 49 | "Variables can store all sorts of things, not just numbers. A typical other " 50 | "thing you want to have stored often is a **string** - a line of text. " 51 | "Strings are indicated with a starting and a leading ``\"`` (double quote). " 52 | "You'll learn about this and other types, as those are called in Python, and " 53 | "what you can do with them later on." 54 | msgstr "" 55 | 56 | #: ../../../source/variables.rst:31 57 | msgid "You can even use a variable to give the turtle a name::" 58 | msgstr "" 59 | 60 | #: ../../../source/variables.rst:35 61 | msgid "" 62 | "Now every time you type ``timmy`` it knows you mean ``turtle``. You can " 63 | "still continue to use ``turtle`` as well::" 64 | msgstr "" 65 | 66 | #: ../../../source/variables.rst:43 67 | msgid "A variable called angle" 68 | msgstr "" 69 | 70 | #: ../../../source/variables.rst:46 ../../../source/variables.rst:83 71 | msgid "Exercise" 72 | msgstr "" 73 | 74 | #: ../../../source/variables.rst:48 75 | msgid "" 76 | "If we have a variable called ``angle``, how could we use that to experiment " 77 | "much faster with our tilted squares program?" 78 | msgstr "" 79 | 80 | #: ../../../source/variables.rst:52 81 | msgid "Solution" 82 | msgstr "" 83 | 84 | #: ../../../source/variables.rst:72 85 | msgid "... and so on" 86 | msgstr "" 87 | 88 | #: ../../../source/variables.rst:75 89 | msgid "Bonus" 90 | msgstr "" 91 | 92 | #: ../../../source/variables.rst:77 93 | msgid "Can you apply that principle to the size of the squares, too?" 94 | msgstr "" 95 | 96 | #: ../../../source/variables.rst:80 97 | msgid "The house of santa claus" 98 | msgstr "" 99 | 100 | #: ../../../source/variables.rst:85 101 | msgid "Draw a house." 102 | msgstr "" 103 | 104 | #: ../../../source/variables.rst:89 105 | msgid "" 106 | "You can calculate the length of the diagonal line with the Pythagorean " 107 | "theorem. That value is a good candidate to store in a variable. To calculate" 108 | " the square root of a number in Python, you'll need to import the *math* " 109 | "module and use the ``math.sqrt()`` function. The square of a number is " 110 | "calculated with the ``**`` operator::" 111 | msgstr "" 112 | -------------------------------------------------------------------------------- /source/where_to_go.rst: -------------------------------------------------------------------------------- 1 | Where to go from here 2 | ********************* 3 | 4 | Learning Python 5 | =============== 6 | 7 | Hopefully this tutorial has tought you just enough python to get you on your 8 | feet. However, there is much more that you can learn! Even professional 9 | programmers will always be trying to learn more about their language and 10 | how to code excellently with it. 11 | 12 | 13 | Books and Tutorials 14 | ------------------- 15 | 16 | If you like learning from a book, there are heaps of good ones, and even many 17 | that can be read freely on the web! 18 | 19 | - `OTS Python Portal`_ - Check the rest of our tutorials, and look out for 20 | future workshops! 21 | - `O'Reilly`_ publishes hundreds of books and ebooks, on python and many other 22 | technologies (check out Learning Python, 5th edition). 23 | - `Invent with Python`_ takes a practical approach, with three different ebooks 24 | that can be read online for free. 25 | - `Learn Python the Hard Way`_ is a step by step full tutorial on the language, 26 | done in a unique style. 27 | - `Dive into Python 3`_ is another great book available online for free! 28 | - Last but not least, python.org has `Its own tutorial!`_ 29 | 30 | 31 | .. _OTS Python Portal: http://python.opentechschool.org/ 32 | .. _O'Reilly: 33 | http://shop.oreilly.com/category/browse-subjects/programming/python.do 34 | .. _Invent with Python: http://inventwithpython.com/ 35 | .. _Learn Python the Hard Way: http://learnpythonthehardway.org/ 36 | .. _Dive into Python 3: http://getpython3.com/diveintopython3/ 37 | .. _Its own tutorial!: http://docs.python.org/3/tutorial/ 38 | 39 | Online learning courses 40 | ------------------------- 41 | 42 | You wouldn't believe what you can do on the web these days. There are many 43 | courses on programming around! 44 | 45 | - `Edx`_ - with top universities like Stanford, MIT, Harvard and Berkley giving 46 | out interactive courses for free, it's hard to turn this down. You'll have 47 | to look for ones coming up soon! 48 | - `Coursera`_ is very similar to Edx, with even more courses, and some that 49 | can be taken at any time. 50 | - `CodeAcademy`_ - luckily this one has a python-specific course that can 51 | be taken at any time, and many other practical language courses. 52 | 53 | 54 | .. _Edx: 55 | https://www.edx.org/course-list/allschools/computer%20science/allcourses 56 | .. _Coursera: 57 | https://www.coursera.org/courses?orderby=upcoming&cats=cs-theory,cs-systems,cs-programming,cs-ai 58 | .. _CodeAcademy: http://www.codecademy.com/ 59 | 60 | 61 | What to do with Python 62 | ====================== 63 | 64 | Well, that's a tough one! See, practically anything you can think of involving 65 | some electronics - from your TV remote, to a smartphone, to the backend of a 66 | popular web service, to the scheduling of airport landings, to the software 67 | you use everyday - it all involves some programming somewhere! 68 | 69 | And not only is it a big field practically, but also technically and 70 | academically. As soon as you have a basic understanding of a general language 71 | like python, you can start working on all manner of subjects: web frontends, 72 | web backend services, data analysis and statistics, Artificial Intelligence, 73 | GUI design, robotics, software development of all kinds, online transactions, 74 | automation of everything, and many more. 75 | 76 | We wouldn't blame if that all sounds daunting, so here's some practical advice, 77 | that takes advantage of how wide a field "programming" is: 78 | 79 | **Apply your new skills to whatever you're passionate about.** 80 | 81 | Whether that's starting a new business, helping you do some task involving data 82 | faster, putting up an online site, calculating advantages in a game you play, 83 | creating art and music, or anything else, finding out how to use programming to 84 | help with whatever floats your boat will make learning much more exciting and 85 | relevant. Feel free to ask someone more experienced if you have no idea where 86 | to start, but always mention what makes you tick! 87 | -------------------------------------------------------------------------------- /fabfile.py: -------------------------------------------------------------------------------- 1 | from fabric.api import local 2 | import os 3 | import sys 4 | if sys.version_info[0] < 3: 5 | import SimpleHTTPServer as httpserver 6 | import SocketServer as socketserver 7 | else: 8 | import http.server as httpserver 9 | import socketserver 10 | 11 | 12 | BASE_DIR = os.path.realpath(os.path.dirname(__file__)) 13 | BUILD_DIR = os.path.join(BASE_DIR, '_build') 14 | SOURCE_DIR = os.path.join(BASE_DIR, 'source') 15 | LOCALE_DIR = os.path.join(SOURCE_DIR, 'locale', 16 | '%s', 'LC_MESSAGES') 17 | LANGUAGES = set(['en', 'de', 'ru', 'ko', 'es_CL', 'ro']) 18 | MAIN_TARGET = 'html' 19 | REPOSITORY = 'git@github.com:OpenTechSchool/python-beginners.git' 20 | SERVE_PORT = 8000 21 | 22 | 23 | def setup(): 24 | """Setup html build directory to push to repo""" 25 | clean() 26 | target_dir = os.path.join(BUILD_DIR, MAIN_TARGET) 27 | local('mkdir -p %s' % target_dir) 28 | local('git clone %s -b %s --single-branch %s' % 29 | (REPOSITORY, 'gh-pages', target_dir)) 30 | 31 | 32 | def build(language=None, target=MAIN_TARGET): 33 | if language is None: 34 | print('Please build a specific language; one of') 35 | print(', '.join(LANGUAGES)) 36 | exit() 37 | elif language not in LANGUAGES: 38 | exit('Language %s not available.' % language) 39 | if os.path.isdir(LOCALE_DIR % language): 40 | compile_pos(language) 41 | args = [ 42 | 'sphinx-build', 43 | '-b', # builder type 44 | target, 45 | '-d', # doctree path 46 | os.path.join(BUILD_DIR, 'doctrees'), 47 | '-D', 48 | 'language=%s' % language, 49 | SOURCE_DIR, 50 | os.path.join(BUILD_DIR, target, language), # output path 51 | ] 52 | local(' '.join(args)) 53 | if 'html' in target: 54 | static_files = os.path.join(BASE_DIR, '_static', '*') 55 | target_dir = os.path.join(BUILD_DIR, target) 56 | local('cp %s %s' % (static_files, target_dir)) 57 | print("build finished; the %s files are in %s." % 58 | (target, os.path.join(BUILD_DIR, target, language))) 59 | 60 | 61 | def clean(language=None, target=MAIN_TARGET): 62 | if language is not None: 63 | local('rm -rf %s' % os.path.join(BUILD_DIR, target, language)) 64 | else: 65 | local('rm -rf %s' % os.path.join(BUILD_DIR, target)) 66 | 67 | 68 | def serve(port=SERVE_PORT, serve_dir=None): 69 | """Run a web server to serve the built project""" 70 | if serve_dir is None: 71 | serve_dir = os.path.join(BUILD_DIR, MAIN_TARGET) 72 | port = int(port) 73 | os.chdir(serve_dir) 74 | handler = httpserver.SimpleHTTPRequestHandler 75 | httpd = socketserver.TCPServer(("", port), handler) 76 | print("serving on http://%s:%s" % httpd.server_address) 77 | httpd.serve_forever() 78 | 79 | 80 | def update_pos(language): 81 | """Update .po files from the source pot files""" 82 | if language not in LANGUAGES: 83 | exit('Language %s not available.' % language) 84 | gen_pots(language) 85 | args = [ 86 | 'sphinx-intl update', 87 | '-l %s ' % language, 88 | '-p', 89 | os.path.join(BUILD_DIR, 'locale', language), 90 | '-c', 91 | os.path.join(SOURCE_DIR, 'conf.py'), 92 | ] 93 | local(' '.join(args)) 94 | 95 | 96 | def compile_pos(language): 97 | """Compile .po files into .mo files""" 98 | if language not in LANGUAGES: 99 | exit('Language %s not available.' % language) 100 | args = [ 101 | 'sphinx-intl build', 102 | '-l %s' % language, 103 | # '-c', 104 | # os.path.join(SOURCE_DIR, 'conf.py'), 105 | ] 106 | local(' '.join(args)) 107 | 108 | 109 | def gen_pots(language='en'): 110 | """Generate .pot templates from sphinx source files""" 111 | args = [ 112 | 'sphinx-build', 113 | '-b gettext', 114 | '-D language=%s' % language, 115 | SOURCE_DIR, 116 | os.path.join(BUILD_DIR, 'locale', language), 117 | ] 118 | local(' '.join(args)) 119 | -------------------------------------------------------------------------------- /source/locale/ru/LC_MESSAGES/logical_operators.po: -------------------------------------------------------------------------------- 1 | # SOME DESCRIPTIVE TITLE. 2 | # Copyright (C) 2012–2014, OpenTechSchool and contributors 3 | # This file is distributed under the same license as the Introduction to Programming with Python package. 4 | # 5 | # Translators: 6 | # sorrymak , 2013-2014 7 | msgid "" 8 | msgstr "" 9 | "Project-Id-Version: Python for beginners\n" 10 | "Report-Msgid-Bugs-To: \n" 11 | "POT-Creation-Date: 2014-06-09 11:00+1000\n" 12 | "PO-Revision-Date: 2014-01-08 12:36+0000\n" 13 | "Last-Translator: sorrymak \n" 14 | "Language-Team: Russian (http://www.transifex.com/projects/p/python-for-beginners/language/ru/)\n" 15 | "MIME-Version: 1.0\n" 16 | "Content-Type: text/plain; charset=UTF-8\n" 17 | "Content-Transfer-Encoding: 8bit\n" 18 | "Language: ru\n" 19 | "Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" 20 | 21 | # 2f20df833f124f9c85714161761b61a0 22 | #: ../../../source/logical_operators.rst:2 23 | msgid "Logical operators" 24 | msgstr "Логические операторы" 25 | 26 | # f311ca6659b4437e989dee0b026e81c5 27 | #: ../../../source/logical_operators.rst:5 28 | msgid "Introduction" 29 | msgstr "Введение" 30 | 31 | # a64bdf21929b492493f49955995ab7bc 32 | #: ../../../source/logical_operators.rst:7 33 | msgid "" 34 | "Conditionals are a nice way to make decisions by asking if something equals " 35 | "*True* or not. But often one condition is not enough. We may want to take " 36 | "the opposite of our result. Or for instance if we want to make a decision " 37 | "upon ``turtle.xcor()`` and ``turtle.ycor()`` we have to combine them. This " 38 | "can be done with logical operators." 39 | msgstr "" 40 | 41 | # 91aa730b80734d2486904a10e87f6973 42 | #: ../../../source/logical_operators.rst:14 43 | msgid "Negation of a statement" 44 | msgstr "Оператор отрицания" 45 | 46 | # 16dd9203364c46d3a5f8c59cd8891fb2 47 | #: ../../../source/logical_operators.rst:16 48 | msgid "" 49 | "If we want something to be *False* we can use ``not``. It is a logical " 50 | "operator::" 51 | msgstr "Если мы хотим сделать что-либо *ложным*, можно использовать ``not``. Это логический оператор::" 52 | 53 | # 98497a179d5d4026bd2f78d00bef5db5 54 | # 13525c7015f848e89385f50b6344f0e5 55 | #: ../../../source/logical_operators.rst:26 56 | #: ../../../source/logical_operators.rst:66 57 | msgid "Exercise" 58 | msgstr "Упражнение" 59 | 60 | # 35d690f787ac4b7a94541491e7069e38 61 | #: ../../../source/logical_operators.rst:28 62 | msgid "" 63 | "The turtle gives us a useful function to know if it is drawing or not: " 64 | "``turtle.isdown()``. This function returns *True* if the turtle is drawing." 65 | " As we have seen earlier, the function ``turtle.penup()`` and " 66 | "``turtle.pendown()`` toggle between drawing while moving, or just moving " 67 | "without a trace." 68 | msgstr "" 69 | 70 | # 3d050f537f894d0092f7bc4ebb7aecc0 71 | #: ../../../source/logical_operators.rst:33 72 | msgid "Can we write a function that only goes forward if the pen is up?" 73 | msgstr "Можно ли написать функцию, которая заставляет черепашку двигаться вперёд, если перо поднято?" 74 | 75 | # 8ec37a98bbce4ccd9ce82d3d6657f779 76 | # 79c8613a80fb446d937f63207d57126b 77 | #: ../../../source/logical_operators.rst:38 78 | #: ../../../source/logical_operators.rst:75 79 | msgid "Solution" 80 | msgstr "Решение" 81 | 82 | # 479b73f64ea14a6984e626cfb3c1b620 83 | #: ../../../source/logical_operators.rst:48 84 | msgid "This and that or something else" 85 | msgstr "" 86 | 87 | # d77af2e96f3840fe90850c25a0981881 88 | #: ../../../source/logical_operators.rst:50 89 | msgid "" 90 | "Two easy to understand operators are ``and`` and ``or``. They do exactly " 91 | "what they sound like:::" 92 | msgstr "Два простых и понятных оператора: ``and`` (\"и\" в переводе с английского) и ``or`` (\"или\" в переводе с английского), которые делают ровно то, что и обозначают::" 93 | 94 | # a1e51836541b45ea81132528be3d7323 95 | #: ../../../source/logical_operators.rst:62 96 | msgid "" 97 | "You are not restricted to one logical operator. You can combine as may as " 98 | "you want." 99 | msgstr "Использовать только один логический оператор не обязательно, можно комбинировать их как угодно." 100 | 101 | # 8b46de8719184531b8b89b8a50b410d8 102 | #: ../../../source/logical_operators.rst:68 103 | msgid "" 104 | "Earlier we put the turtle in a circular prison. This time let's make it a " 105 | "box. If the turtle goes more than 100 in the X *or* Y axis then we turn the " 106 | "turtle back around to the center." 107 | msgstr "" 108 | -------------------------------------------------------------------------------- /source/conditional_loops.rst: -------------------------------------------------------------------------------- 1 | Conditional Loops 2 | ***************** 3 | Introduction 4 | ============ 5 | 6 | Conditional loops are way to repeat something while a certain condition 7 | is satisfied, or **True**. If the condition is always satisfied (never 8 | becomes **False**), the loop can become infinite. 9 | If the condition starts off false, the code in the loop will never run! 10 | In Python conditional loops are defined with the ``while`` statement:: 11 | 12 | word = '' 13 | sentence = '' 14 | print('Please enter some words.') 15 | print('Include a period (.) when you are finished.') 16 | while '.' not in word: 17 | word = input('next word: ') 18 | sentence = word + ' ' + sentence 19 | print() 20 | print('Aha! You said:') 21 | print(sentence) 22 | 23 | We call this part of the code the 'conditional': ``'.' not in word`` 24 | 25 | Whether the conditional returns True or not determines whether the code inside 26 | the ``while`` loop runs. Of course, it repeats the check every time the loop 27 | is run again. 28 | 29 | Read the code above, and see if you can summarise in your head what 30 | it should do (what its final output will be). 31 | 32 | Then copy it into a file, say :file:`sentence.py` and run it - see 33 | exactly what it does. Does that match up with what you thought? 34 | 35 | .. note:: 36 | 37 | If you are using Python 2, you will need to replace ``input`` with 38 | ``raw_input`` to run the program correctly. 39 | 40 | Turtle prison 41 | ============= 42 | 43 | Exercise 44 | -------- 45 | 46 | The turtle has been up to its usual tricks again, robbing liquor 47 | stores and building up huge gambling debts. It's time for turtle to be 48 | put into a cell that it can't get out of. 49 | 50 | Let's make a new version of ``forward()``. One that will turn the turtle 51 | around if it tries to go further than 100 from the origin. We'll need 52 | a ``while`` loop, and some new turtle functions: 53 | 54 | * ``turtle.distance(0, 0)`` - Returns the distance of the turtle from 55 | the origin (0, 0) 56 | * ``turtle.towards(0, 0)`` - Returns the angle to get back to origin (0, 0) 57 | * ``turtle.setheading(angle)`` - Directly sets the turtle's direction 58 | 59 | You could try playing with a turtle in the interpreter and using these 60 | functions to check exactly what they do, if you like. 61 | 62 | Now you will need to implement the prison logic using these turtle 63 | functions, perhaps a ``while`` loop and a bit of conditional logic. 64 | It's a bit of a stretch but keep at it! Don't be afraid to talk it out 65 | with a coach or another student. 66 | 67 | .. rst-class:: solution 68 | 69 | Solution 70 | -------- 71 | 72 | :: 73 | 74 | def forward(distance): 75 | while distance > 0: 76 | if turtle.distance(0,0) > 100: 77 | angle = turtle.towards(0,0) 78 | turtle.setheading(angle) 79 | turtle.forward(1) 80 | distance = distance - 1 81 | 82 | 83 | Draw a spiral 84 | ============= 85 | 86 | Loops can be interrupted with the ``break`` statement. This is 87 | especially useful if you write an *infinite loop*, which is a loop 88 | where the conditional is always **True**. 89 | 90 | Exercise 91 | -------- 92 | 93 | Write a ``while`` loop with a condition that is always **True** 94 | to draw a spiral. Interrupt the loop when the turtle reaches a certain distance 95 | from the center. Use the function ``turtle.distance(x, y)`` to get the 96 | turtle's distance to the point defined by the coordinates ``x`` and ``y``. 97 | 98 | To do this you will need the ``turtle.xcor()`` and ``turtle.ycor()`` 99 | functions, which return the position of the turtle in X and Y axes 100 | respectively. 101 | 102 | .. note:: 103 | 104 | To draw a spiral, the turtle has to rotate by a constant value and move 105 | forward by an increasing value. 106 | 107 | .. rst-class:: solution 108 | 109 | Solution 110 | -------- 111 | 112 | :: 113 | 114 | def draw_spiral(radius): 115 | original_xcor = turtle.xcor() 116 | original_ycor = turtle.ycor() 117 | speed = 1 118 | while True: 119 | turtle.forward(speed) 120 | turtle.left(10) 121 | speed += 0.1 122 | if turtle.distance(original_xcor, original_ycor) > radius: 123 | break 124 | 125 | Bonus 126 | ----- 127 | 128 | Can you make a conditional for this loop, so you don't need the 129 | infinite loop ``while True`` or the ``break``? Which version do you find 130 | easier to understand? 131 | -------------------------------------------------------------------------------- /source/locale/ro/LC_MESSAGES/logical_operators.po: -------------------------------------------------------------------------------- 1 | # SOME DESCRIPTIVE TITLE. 2 | # Copyright (C) 2012–2014, OpenTechSchool and contributors 3 | # This file is distributed under the same license as the Introduction to Programming with Python package. 4 | # 5 | # Translators: 6 | # Razvan Stefanescu , 2015 7 | msgid "" 8 | msgstr "" 9 | "Project-Id-Version: Python for beginners\n" 10 | "Report-Msgid-Bugs-To: \n" 11 | "POT-Creation-Date: 2015-10-02 06:32+1000\n" 12 | "PO-Revision-Date: 2015-04-01 11:55+0000\n" 13 | "Last-Translator: Razvan Stefanescu \n" 14 | "Language-Team: Romanian (http://www.transifex.com/opentechschool/python-for-beginners/language/ro/)\n" 15 | "MIME-Version: 1.0\n" 16 | "Content-Type: text/plain; charset=UTF-8\n" 17 | "Content-Transfer-Encoding: 8bit\n" 18 | "Language: ro\n" 19 | "Plural-Forms: nplurals=3; plural=(n==1?0:(((n%100>19)||((n%100==0)&&(n!=0)))?2:1));\n" 20 | 21 | #: ../../../source/logical_operators.rst:2 22 | msgid "Logical operators" 23 | msgstr "Operatori logici" 24 | 25 | #: ../../../source/logical_operators.rst:5 26 | msgid "Introduction" 27 | msgstr "Introducere" 28 | 29 | #: ../../../source/logical_operators.rst:7 30 | msgid "" 31 | "Conditionals are a nice way to make decisions by asking if something equals " 32 | "*True* or not. But often one condition is not enough. We may want to take " 33 | "the opposite of our result. Or for instance if we want to make a decision " 34 | "upon ``turtle.xcor()`` and ``turtle.ycor()`` we have to combine them. This " 35 | "can be done with logical operators." 36 | msgstr "Condițiile sunt o formă comodă de a lua decizii întrebându-ne dacă ceva are valoare *Adevărat* sau nu. Dar de multe ori o condiție nu e suficientă. Am putea dori să facem opusul. Sau de exemplu dacă dorim să luăm o decizie bazată pe ``turtle.xcor()`` și``turtle.ycor()`` atunci trebuie să le combinăm. Asta se poate rezolva cu operatori logici." 37 | 38 | #: ../../../source/logical_operators.rst:14 39 | msgid "Negation of a statement" 40 | msgstr "Negarea unei declarații" 41 | 42 | #: ../../../source/logical_operators.rst:16 43 | msgid "" 44 | "If we want something to be *False* we can use ``not``. It is a logical " 45 | "operator::" 46 | msgstr "Dacă dorim ca ceva să fie *Fals* putem utiliza ``not``. Este un operator logic:" 47 | 48 | #: ../../../source/logical_operators.rst:26 49 | #: ../../../source/logical_operators.rst:66 50 | msgid "Exercise" 51 | msgstr "Exercițiu" 52 | 53 | #: ../../../source/logical_operators.rst:28 54 | msgid "" 55 | "The turtle gives us a useful function to know if it is drawing or not: " 56 | "``turtle.isdown()``. This function returns *True* if the turtle is drawing." 57 | " As we have seen earlier, the function ``turtle.penup()`` and " 58 | "``turtle.pendown()`` toggle between drawing while moving, or just moving " 59 | "without a trace." 60 | msgstr "Țestoasa ne pune la dispoziție o funcție utilă pentru a ști dacă desenează sau nu: ``turtle.isdown()``. Această funcție returnează *Adevărat* dacă țestoasa desenează. După cum am văzut mai devreme, funcțiile ``turtle.penup()`` și ``turtle.pendown()`` schimbă între desen și mișcare, sau doar mișcare fără a trasa nici o urmă." 61 | 62 | #: ../../../source/logical_operators.rst:33 63 | msgid "Can we write a function that only goes forward if the pen is up?" 64 | msgstr "Putem scrie o funcție care înaintează doar dacă penița este ridicată?" 65 | 66 | #: ../../../source/logical_operators.rst:38 67 | #: ../../../source/logical_operators.rst:75 68 | msgid "Solution" 69 | msgstr "Soluție" 70 | 71 | #: ../../../source/logical_operators.rst:48 72 | msgid "This and that or something else" 73 | msgstr "Asta și aia sau altceva" 74 | 75 | #: ../../../source/logical_operators.rst:50 76 | msgid "" 77 | "Two easy to understand operators are ``and`` and ``or``. They do exactly " 78 | "what they sound like:::" 79 | msgstr "Doi operatori ușor de înțeles sunt ``and`` (și) și ``or`` (sau). Ei fac exact ce spune numele lor:" 80 | 81 | #: ../../../source/logical_operators.rst:62 82 | msgid "" 83 | "You are not restricted to one logical operator. You can combine as may as " 84 | "you want." 85 | msgstr "Nu ești limitat la un singur operator logic. Poți combina oricâți de mulți dorești." 86 | 87 | #: ../../../source/logical_operators.rst:68 88 | msgid "" 89 | "Earlier we put the turtle in a circular prison. This time let's make it a " 90 | "box. If the turtle goes more than 100 in the X *or* Y axis then we turn the " 91 | "turtle back around to the center." 92 | msgstr "Mai devreme am pus țestoasa într-o închisoare circulară. De această dată să o punem într-o cutie. Dacă țestoasa merge mai mult de 100 pe axele X *sau* Y atunci întoarcem țestoasta înapoi spre centru." 93 | -------------------------------------------------------------------------------- /source/locale/ko/LC_MESSAGES/logical_operators.po: -------------------------------------------------------------------------------- 1 | # SOME DESCRIPTIVE TITLE. 2 | # Copyright (C) 2012–2014, OpenTechSchool and contributors 3 | # This file is distributed under the same license as the Introduction to Programming with Python package. 4 | # 5 | # Translators: 6 | # Seong-ho Cho , 2014 7 | msgid "" 8 | msgstr "" 9 | "Project-Id-Version: Python for beginners\n" 10 | "Report-Msgid-Bugs-To: \n" 11 | "POT-Creation-Date: 2014-06-09 11:00+1000\n" 12 | "PO-Revision-Date: 2014-02-22 21:21+0000\n" 13 | "Last-Translator: Seong-ho Cho \n" 14 | "Language-Team: Korean (http://www.transifex.com/projects/p/python-for-beginners/language/ko/)\n" 15 | "MIME-Version: 1.0\n" 16 | "Content-Type: text/plain; charset=UTF-8\n" 17 | "Content-Transfer-Encoding: 8bit\n" 18 | "Language: ko\n" 19 | "Plural-Forms: nplurals=1; plural=0;\n" 20 | 21 | # 2f20df833f124f9c85714161761b61a0 22 | #: ../../../source/logical_operators.rst:2 23 | msgid "Logical operators" 24 | msgstr "논리 연산자" 25 | 26 | # f311ca6659b4437e989dee0b026e81c5 27 | #: ../../../source/logical_operators.rst:5 28 | msgid "Introduction" 29 | msgstr "소개" 30 | 31 | # a64bdf21929b492493f49955995ab7bc 32 | #: ../../../source/logical_operators.rst:7 33 | msgid "" 34 | "Conditionals are a nice way to make decisions by asking if something equals " 35 | "*True* or not. But often one condition is not enough. We may want to take " 36 | "the opposite of our result. Or for instance if we want to make a decision " 37 | "upon ``turtle.xcor()`` and ``turtle.ycor()`` we have to combine them. This " 38 | "can be done with logical operators." 39 | msgstr "조건문은 어떤 조건이 *True*인지 아닌지 요청하여 결정하는데 좋은 방법이긴 해요. 근데 하나의 조건 가지고는 충분하지 않을 때가 자주 있죠. 아마 결과의 반대를 취하려 할거예요. 아니면 ``turtle.xcor()`` 랑 ``turtle.ycor()`` 로 결정하려 한다면 이걸 결합해야 해요. 논리 연산자를 쓰면 해결할 수 있어요." 40 | 41 | # 91aa730b80734d2486904a10e87f6973 42 | #: ../../../source/logical_operators.rst:14 43 | msgid "Negation of a statement" 44 | msgstr "조건의 부정" 45 | 46 | # 16dd9203364c46d3a5f8c59cd8891fb2 47 | #: ../../../source/logical_operators.rst:16 48 | msgid "" 49 | "If we want something to be *False* we can use ``not``. It is a logical " 50 | "operator::" 51 | msgstr "무언가 *False*로 되돌리고 싶으면 ``not``을 쓸 수 있어요. 이건 논리 연산자거든요::" 52 | 53 | # 98497a179d5d4026bd2f78d00bef5db5 54 | # 13525c7015f848e89385f50b6344f0e5 55 | #: ../../../source/logical_operators.rst:26 56 | #: ../../../source/logical_operators.rst:66 57 | msgid "Exercise" 58 | msgstr "연습" 59 | 60 | # 35d690f787ac4b7a94541491e7069e38 61 | #: ../../../source/logical_operators.rst:28 62 | msgid "" 63 | "The turtle gives us a useful function to know if it is drawing or not: " 64 | "``turtle.isdown()``. This function returns *True* if the turtle is drawing." 65 | " As we have seen earlier, the function ``turtle.penup()`` and " 66 | "``turtle.pendown()`` toggle between drawing while moving, or just moving " 67 | "without a trace." 68 | msgstr "거북이가 화면을 지나가면서 그렸는지 안그렸는지 확인하도록 쓸모있는 함수를 주는데요, 그걸 ``turtle.isdown()``이라고 하겠습니다. 이 합수는 거북이가 그림을 그리면 *True* 값을 반환해요. 앞에서 보신대로 ``turtle.penup()`` 과``turtle.pendown()`` 토글 함수는 움직이는 동안 그릴것이냐, 그리지 않고 그냥 움직이기만 할 것이냐의 상태를 바꾸어요." 69 | 70 | # 3d050f537f894d0092f7bc4ebb7aecc0 71 | #: ../../../source/logical_operators.rst:33 72 | msgid "Can we write a function that only goes forward if the pen is up?" 73 | msgstr "단순히 펜을 들었을때 전진만하는 함수를 작성할 수 있을까요?" 74 | 75 | # 8ec37a98bbce4ccd9ce82d3d6657f779 76 | # 79c8613a80fb446d937f63207d57126b 77 | #: ../../../source/logical_operators.rst:38 78 | #: ../../../source/logical_operators.rst:75 79 | msgid "Solution" 80 | msgstr "해결책" 81 | 82 | # 479b73f64ea14a6984e626cfb3c1b620 83 | #: ../../../source/logical_operators.rst:48 84 | msgid "This and that or something else" 85 | msgstr "이거 저거 아니면 다른거요" 86 | 87 | # d77af2e96f3840fe90850c25a0981881 88 | #: ../../../source/logical_operators.rst:50 89 | msgid "" 90 | "Two easy to understand operators are ``and`` and ``or``. They do exactly " 91 | "what they sound like:::" 92 | msgstr "이해하기 쉬운 두 개의 연산자로는 ``and``랑 ``or``가 있어요. 말 그대로 동작해요:::" 93 | 94 | # a1e51836541b45ea81132528be3d7323 95 | #: ../../../source/logical_operators.rst:62 96 | msgid "" 97 | "You are not restricted to one logical operator. You can combine as may as " 98 | "you want." 99 | msgstr "하나의 논리 연산자를 쓰는데 제한을 받진 않아요. 원하는 대로 붙일 수 있어요." 100 | 101 | # 8b46de8719184531b8b89b8a50b410d8 102 | #: ../../../source/logical_operators.rst:68 103 | msgid "" 104 | "Earlier we put the turtle in a circular prison. This time let's make it a " 105 | "box. If the turtle goes more than 100 in the X *or* Y axis then we turn the " 106 | "turtle back around to the center." 107 | msgstr "이미 원형 감옥에 거북이를 놓았었어요. 이제 상자를 만들어보기로 하겠어요. 거북이가 X *or* Y 방향으로 100 이상을 가면, 거북이를 가운데 주변으로 다시 돌려놓겠어요." 108 | -------------------------------------------------------------------------------- /source/locale/en/LC_MESSAGES/functions_parameters.po: -------------------------------------------------------------------------------- 1 | # 2 | msgid "" 3 | msgstr "" 4 | "Project-Id-Version: Introduction to Programming with Python 0.1\n" 5 | "Report-Msgid-Bugs-To: \n" 6 | "POT-Creation-Date: 2013-10-25 09:37\n" 7 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 8 | "Last-Translator: FULL NAME \n" 9 | "Language-Team: LANGUAGE \n" 10 | "MIME-Version: 1.0\n" 11 | "Content-Type: text/plain; charset=UTF-8\n" 12 | "Content-Transfer-Encoding: 8bit\n" 13 | 14 | #: ../../../source/functions_parameters.rst:2 15 | msgid "Functions with parameters" 16 | msgstr "" 17 | 18 | #: ../../../source/functions_parameters.rst:5 19 | msgid "Introduction" 20 | msgstr "" 21 | 22 | #: ../../../source/functions_parameters.rst:7 23 | msgid "" 24 | "As we shrink down our code and add functions to remove duplication, we are " 25 | "*factorizing* it. This is a good thing to do. But the functions we have " 26 | "defined so far are not very flexible. The variables are defined inside the " 27 | "function, so if we want to use a different angle or a distance then we need " 28 | "to write a new function. Our hexagon function can only draw one size of " 29 | "hexagon!" 30 | msgstr "" 31 | 32 | #: ../../../source/functions_parameters.rst:14 33 | msgid "" 34 | "That is why we need to be able to give parameters, also called *arguments*, " 35 | "to the function. This way the *variables* in the function can have " 36 | "different values each time we call the function:" 37 | msgstr "" 38 | 39 | #: ../../../source/functions_parameters.rst:18 40 | msgid "" 41 | "Remember how we defined the function ``line_without_moving()`` in the " 42 | "previous section::" 43 | msgstr "" 44 | 45 | #: ../../../source/functions_parameters.rst:25 46 | msgid "We can improve it by giving it a parameter::" 47 | msgstr "" 48 | 49 | #: ../../../source/functions_parameters.rst:31 50 | msgid "" 51 | "The parameter acts as a *variable* only known inside the function's " 52 | "definition. We use the newly defined function by calling it with the value " 53 | "we want the parameter to have like this::" 54 | msgstr "" 55 | 56 | #: ../../../source/functions_parameters.rst:38 57 | msgid "" 58 | "We have been using functions with parameters since the beginning of the " 59 | "tutorial with ``turtle.forward()``, ``turtle.left()``, etc..." 60 | msgstr "" 61 | 62 | #: ../../../source/functions_parameters.rst:41 63 | msgid "" 64 | "And we can put as many arguments (or parameters) as we want, separating them" 65 | " with commas and giving them different names::" 66 | msgstr "" 67 | 68 | #: ../../../source/functions_parameters.rst:50 69 | msgid "A parameterized function for a variable size hexagon" 70 | msgstr "" 71 | 72 | #: ../../../source/functions_parameters.rst:53 73 | #: ../../../source/functions_parameters.rst:72 74 | msgid "Exercise" 75 | msgstr "" 76 | 77 | #: ../../../source/functions_parameters.rst:55 78 | msgid "" 79 | "Write a function that allows you to draw hexagons of any size you want, each" 80 | " time you call the function." 81 | msgstr "" 82 | 83 | #: ../../../source/functions_parameters.rst:59 84 | #: ../../../source/functions_parameters.rst:86 85 | msgid "Solution" 86 | msgstr "" 87 | 88 | #: ../../../source/functions_parameters.rst:69 89 | msgid "A function of several parameters" 90 | msgstr "" 91 | 92 | #: ../../../source/functions_parameters.rst:74 93 | msgid "" 94 | "Write a function that will draw a shape of *any* number of sides (let's " 95 | "assume greater than two) of any side length. Get it to draw some different " 96 | "shapes." 97 | msgstr "" 98 | 99 | #: ../../../source/functions_parameters.rst:77 100 | msgid "Here's an example of drawing shapes with this function:" 101 | msgstr "" 102 | 103 | #: ../../../source/functions_parameters.rst:83 104 | msgid "The sum of the internal angles of any shape is always 360 degrees!" 105 | msgstr "" 106 | 107 | #: ../../../source/functions_parameters.rst:96 108 | msgid "Bonus" 109 | msgstr "" 110 | 111 | #: ../../../source/functions_parameters.rst:98 112 | msgid "" 113 | "It might sound crazy, but it's perfectly possible to pass a *function* as a " 114 | "parameter to another function! Python regards functions as perfectly normal " 115 | "'things', the same as variables, numbers and strings." 116 | msgstr "" 117 | 118 | #: ../../../source/functions_parameters.rst:102 119 | msgid "" 120 | "For instance, you could create a shape drawing function which turned one way" 121 | " or another depending on which turtle function you passed to it - " 122 | "``turtle.left`` or ``turtle.right``." 123 | msgstr "" 124 | 125 | #: ../../../source/functions_parameters.rst:105 126 | msgid "See if you can implement this!" 127 | msgstr "" 128 | 129 | #: ../../../source/functions_parameters.rst:109 130 | msgid "" 131 | "Passing a function (e.g ``turtle.left``) is different than *calling* it, " 132 | "which would instead be written ``turtle.left(45)``." 133 | msgstr "" 134 | -------------------------------------------------------------------------------- /source/locale/fr/LC_MESSAGES/functions_parameters.po: -------------------------------------------------------------------------------- 1 | # 2 | msgid "" 3 | msgstr "" 4 | "Project-Id-Version: Introduction to Programming with Python 0.1\n" 5 | "Report-Msgid-Bugs-To: \n" 6 | "POT-Creation-Date: 2013-10-25 09:14\n" 7 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 8 | "Last-Translator: FULL NAME \n" 9 | "Language-Team: LANGUAGE \n" 10 | "MIME-Version: 1.0\n" 11 | "Content-Type: text/plain; charset=UTF-8\n" 12 | "Content-Transfer-Encoding: 8bit\n" 13 | 14 | #: ../../../source/functions_parameters.rst:2 15 | msgid "Functions with parameters" 16 | msgstr "" 17 | 18 | #: ../../../source/functions_parameters.rst:5 19 | msgid "Introduction" 20 | msgstr "" 21 | 22 | #: ../../../source/functions_parameters.rst:7 23 | msgid "" 24 | "As we shrink down our code and add functions to remove duplication, we are " 25 | "*factorizing* it. This is a good thing to do. But the functions we have " 26 | "defined so far are not very flexible. The variables are defined inside the " 27 | "function, so if we want to use a different angle or a distance then we need " 28 | "to write a new function. Our hexagon function can only draw one size of " 29 | "hexagon!" 30 | msgstr "" 31 | 32 | #: ../../../source/functions_parameters.rst:14 33 | msgid "" 34 | "That is why we need to be able to give parameters, also called *arguments*, " 35 | "to the function. This way the *variables* in the function can have " 36 | "different values each time we call the function:" 37 | msgstr "" 38 | 39 | #: ../../../source/functions_parameters.rst:18 40 | msgid "" 41 | "Remember how we defined the function ``line_without_moving()`` in the " 42 | "previous section::" 43 | msgstr "" 44 | 45 | #: ../../../source/functions_parameters.rst:25 46 | msgid "We can improve it by giving it a parameter::" 47 | msgstr "" 48 | 49 | #: ../../../source/functions_parameters.rst:31 50 | msgid "" 51 | "The parameter acts as a *variable* only known inside the function's " 52 | "definition. We use the newly defined function by calling it with the value " 53 | "we want the parameter to have like this::" 54 | msgstr "" 55 | 56 | #: ../../../source/functions_parameters.rst:38 57 | msgid "" 58 | "We have been using functions with parameters since the beginning of the " 59 | "tutorial with ``turtle.forward()``, ``turtle.left()``, etc..." 60 | msgstr "" 61 | 62 | #: ../../../source/functions_parameters.rst:41 63 | msgid "" 64 | "And we can put as many arguments (or parameters) as we want, separating them" 65 | " with commas and giving them different names::" 66 | msgstr "" 67 | 68 | #: ../../../source/functions_parameters.rst:50 69 | msgid "A parameterized function for a variable size hexagon" 70 | msgstr "" 71 | 72 | #: ../../../source/functions_parameters.rst:53 73 | #: ../../../source/functions_parameters.rst:72 74 | msgid "Exercise" 75 | msgstr "" 76 | 77 | #: ../../../source/functions_parameters.rst:55 78 | msgid "" 79 | "Write a function that allows you to draw hexagons of any size you want, each" 80 | " time you call the function." 81 | msgstr "" 82 | 83 | #: ../../../source/functions_parameters.rst:59 84 | #: ../../../source/functions_parameters.rst:86 85 | msgid "Solution" 86 | msgstr "" 87 | 88 | #: ../../../source/functions_parameters.rst:69 89 | msgid "A function of several parameters" 90 | msgstr "" 91 | 92 | #: ../../../source/functions_parameters.rst:74 93 | msgid "" 94 | "Write a function that will draw a shape of *any* number of sides (let's " 95 | "assume greater than two) of any side length. Get it to draw some different " 96 | "shapes." 97 | msgstr "" 98 | 99 | #: ../../../source/functions_parameters.rst:77 100 | msgid "Here's an example of drawing shapes with this function:" 101 | msgstr "" 102 | 103 | #: ../../../source/functions_parameters.rst:83 104 | msgid "The sum of the internal angles of any shape is always 360 degrees!" 105 | msgstr "" 106 | 107 | #: ../../../source/functions_parameters.rst:96 108 | msgid "Bonus" 109 | msgstr "" 110 | 111 | #: ../../../source/functions_parameters.rst:98 112 | msgid "" 113 | "It might sound crazy, but it's perfectly possible to pass a *function* as a " 114 | "parameter to another function! Python regards functions as perfectly normal " 115 | "'things', the same as variables, numbers and strings." 116 | msgstr "" 117 | 118 | #: ../../../source/functions_parameters.rst:102 119 | msgid "" 120 | "For instance, you could create a shape drawing function which turned one way" 121 | " or another depending on which turtle function you passed to it - " 122 | "``turtle.left`` or ``turtle.right``." 123 | msgstr "" 124 | 125 | #: ../../../source/functions_parameters.rst:105 126 | msgid "See if you can implement this!" 127 | msgstr "" 128 | 129 | #: ../../../source/functions_parameters.rst:109 130 | msgid "" 131 | "Passing a function (e.g ``turtle.left``) is different than *calling* it, " 132 | "which would instead be written ``turtle.left(45)``." 133 | msgstr "" 134 | -------------------------------------------------------------------------------- /source/locale/en/LC_MESSAGES/conditionals.po: -------------------------------------------------------------------------------- 1 | # 2 | msgid "" 3 | msgstr "" 4 | "Project-Id-Version: Introduction to Programming with Python 0.1\n" 5 | "Report-Msgid-Bugs-To: \n" 6 | "POT-Creation-Date: 2013-10-25 09:37\n" 7 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 8 | "Last-Translator: FULL NAME \n" 9 | "Language-Team: LANGUAGE \n" 10 | "MIME-Version: 1.0\n" 11 | "Content-Type: text/plain; charset=UTF-8\n" 12 | "Content-Transfer-Encoding: 8bit\n" 13 | 14 | #: ../../../source/conditionals.rst:2 15 | msgid "Conditional statements" 16 | msgstr "" 17 | 18 | #: ../../../source/conditionals.rst:5 19 | msgid "Introduction" 20 | msgstr "" 21 | 22 | #: ../../../source/conditionals.rst:7 23 | msgid "" 24 | "So far we have accomplished predefined tasks, but in all honesty we were " 25 | "accomplishing no better than old-time music boxes following one set of " 26 | "instructions to the end. What makes programming so much more powerful are " 27 | "conditional statements. This is the ability to *test* a variable against a " 28 | "value and act in one way if the condition is met by the variable or another " 29 | "way if not. They are also commonly called by programmers *if statements*." 30 | msgstr "" 31 | 32 | #: ../../../source/conditionals.rst:15 33 | msgid "" 34 | "To know if a condition is *True* of *False*, we need a new type of data: the" 35 | " booleans. They allow logical operations. A logic statement or operation can" 36 | " be evaluated to be *True* or *False*. Our conditional statement can then be" 37 | " understood like this:" 38 | msgstr "" 39 | 40 | #: ../../../source/conditionals.rst:20 41 | msgid "**if** *(a condition evaluates to True)*:" 42 | msgstr "" 43 | 44 | #: ../../../source/conditionals.rst:21 45 | msgid "*then do these things only for 'True'*" 46 | msgstr "" 47 | 48 | #: ../../../source/conditionals.rst:23 49 | msgid "**else**:" 50 | msgstr "" 51 | 52 | #: ../../../source/conditionals.rst:23 53 | msgid "*otherwise do these things only for 'False'*." 54 | msgstr "" 55 | 56 | #: ../../../source/conditionals.rst:25 57 | msgid "" 58 | "The condition can be anything that evaluates as *True* or *False*. " 59 | "Comparisons always return *True* or *False*, for example ``==`` (equal to), " 60 | "``>`` (greater than), ``<`` (less than.)" 61 | msgstr "" 62 | 63 | #: ../../../source/conditionals.rst:29 64 | msgid "" 65 | "The **else** part is optional. If you leave it off, nothing will happen if " 66 | "the conditional evaluates to 'False'." 67 | msgstr "" 68 | 69 | #: ../../../source/conditionals.rst:34 70 | msgid "Examples" 71 | msgstr "" 72 | 73 | #: ../../../source/conditionals.rst:36 74 | msgid "" 75 | "Here are some examples. You may want to read them over line-by-line and see " 76 | "what you think they do, or run them to be certain::" 77 | msgstr "" 78 | 79 | #: ../../../source/conditionals.rst:54 80 | msgid "Giving Directions" 81 | msgstr "" 82 | 83 | #: ../../../source/conditionals.rst:56 84 | msgid "" 85 | "Python turtles can be very good at following instructions. Let's use the " 86 | "``input()`` function to ask the user for a direction to move the turtle. To " 87 | "keep things easy we will only accept two instructions: \"left\" and " 88 | "\"right\"." 89 | msgstr "" 90 | 91 | #: ../../../source/conditionals.rst:63 92 | msgid "Using Python 2? The ``input()`` function is called ``raw_input()``." 93 | msgstr "" 94 | 95 | #: ../../../source/conditionals.rst:65 96 | msgid "It's much easier to define this as a function, like so::" 97 | msgstr "" 98 | 99 | #: ../../../source/conditionals.rst:76 100 | msgid "" 101 | "Now whenever you use ``move()`` you are prompted to choose ``left`` or " 102 | "``right``." 103 | msgstr "" 104 | 105 | #: ../../../source/conditionals.rst:81 106 | msgid "\"data munging\"" 107 | msgstr "" 108 | 109 | #: ../../../source/conditionals.rst:83 110 | msgid "" 111 | "In this program, the turtle will only respond to exactly ``left`` or " 112 | "``right`` with no variation. Though ``Left`` or ``LEFT`` might seem the same" 113 | " as ``left`` to a human, that isn't the case when programming. Python has a " 114 | "few utility methods to help with that. A string has the methods " 115 | "``.strip()``, which removes whitespace and ``.lower()`` which makes " 116 | "everything lower-case." 117 | msgstr "" 118 | 119 | #: ../../../source/conditionals.rst:90 120 | msgid "" 121 | "Here are some examples to print out the effects of ``.strip()`` and " 122 | "``.lower()``::" 123 | msgstr "" 124 | 125 | #: ../../../source/conditionals.rst:99 126 | msgid "" 127 | "Try adding ``direction = direction.strip().lower()`` to the ``move()`` " 128 | "function, to see the effect. We often call this kind of code \"data " 129 | "munging\", and it is very common." 130 | msgstr "" 131 | 132 | #: ../../../source/conditionals.rst:103 133 | msgid "" 134 | "Can you add some extra input choices to make the turtle draw other things? " 135 | "How about ``hexagon``?" 136 | msgstr "" 137 | -------------------------------------------------------------------------------- /source/locale/fr/LC_MESSAGES/conditionals.po: -------------------------------------------------------------------------------- 1 | # 2 | msgid "" 3 | msgstr "" 4 | "Project-Id-Version: Introduction to Programming with Python 0.1\n" 5 | "Report-Msgid-Bugs-To: \n" 6 | "POT-Creation-Date: 2013-10-25 09:14\n" 7 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 8 | "Last-Translator: FULL NAME \n" 9 | "Language-Team: LANGUAGE \n" 10 | "MIME-Version: 1.0\n" 11 | "Content-Type: text/plain; charset=UTF-8\n" 12 | "Content-Transfer-Encoding: 8bit\n" 13 | 14 | #: ../../../source/conditionals.rst:2 15 | msgid "Conditional statements" 16 | msgstr "" 17 | 18 | #: ../../../source/conditionals.rst:5 19 | msgid "Introduction" 20 | msgstr "" 21 | 22 | #: ../../../source/conditionals.rst:7 23 | msgid "" 24 | "So far we have accomplished predefined tasks, but in all honesty we were " 25 | "accomplishing no better than old-time music boxes following one set of " 26 | "instructions to the end. What makes programming so much more powerful are " 27 | "conditional statements. This is the ability to *test* a variable against a " 28 | "value and act in one way if the condition is met by the variable or another " 29 | "way if not. They are also commonly called by programmers *if statements*." 30 | msgstr "" 31 | 32 | #: ../../../source/conditionals.rst:15 33 | msgid "" 34 | "To know if a condition is *True* of *False*, we need a new type of data: the" 35 | " booleans. They allow logical operations. A logic statement or operation can" 36 | " be evaluated to be *True* or *False*. Our conditional statement can then be" 37 | " understood like this:" 38 | msgstr "" 39 | 40 | #: ../../../source/conditionals.rst:20 41 | msgid "**if** *(a condition evaluates to True)*:" 42 | msgstr "" 43 | 44 | #: ../../../source/conditionals.rst:21 45 | msgid "*then do these things only for 'True'*" 46 | msgstr "" 47 | 48 | #: ../../../source/conditionals.rst:23 49 | msgid "**else**:" 50 | msgstr "" 51 | 52 | #: ../../../source/conditionals.rst:23 53 | msgid "*otherwise do these things only for 'False'*." 54 | msgstr "" 55 | 56 | #: ../../../source/conditionals.rst:25 57 | msgid "" 58 | "The condition can be anything that evaluates as *True* or *False*. " 59 | "Comparisons always return *True* or *False*, for example ``==`` (equal to), " 60 | "``>`` (greater than), ``<`` (less than.)" 61 | msgstr "" 62 | 63 | #: ../../../source/conditionals.rst:29 64 | msgid "" 65 | "The **else** part is optional. If you leave it off, nothing will happen if " 66 | "the conditional evaluates to 'False'." 67 | msgstr "" 68 | 69 | #: ../../../source/conditionals.rst:34 70 | msgid "Examples" 71 | msgstr "" 72 | 73 | #: ../../../source/conditionals.rst:36 74 | msgid "" 75 | "Here are some examples. You may want to read them over line-by-line and see " 76 | "what you think they do, or run them to be certain::" 77 | msgstr "" 78 | 79 | #: ../../../source/conditionals.rst:54 80 | msgid "Giving Directions" 81 | msgstr "" 82 | 83 | #: ../../../source/conditionals.rst:56 84 | msgid "" 85 | "Python turtles can be very good at following instructions. Let's use the " 86 | "``input()`` function to ask the user for a direction to move the turtle. To " 87 | "keep things easy we will only accept two instructions: \"left\" and " 88 | "\"right\"." 89 | msgstr "" 90 | 91 | #: ../../../source/conditionals.rst:63 92 | msgid "Using Python 2? The ``input()`` function is called ``raw_input()``." 93 | msgstr "" 94 | 95 | #: ../../../source/conditionals.rst:65 96 | msgid "It's much easier to define this as a function, like so::" 97 | msgstr "" 98 | 99 | #: ../../../source/conditionals.rst:76 100 | msgid "" 101 | "Now whenever you use ``move()`` you are prompted to choose ``left`` or " 102 | "``right``." 103 | msgstr "" 104 | 105 | #: ../../../source/conditionals.rst:81 106 | msgid "\"data munging\"" 107 | msgstr "" 108 | 109 | #: ../../../source/conditionals.rst:83 110 | msgid "" 111 | "In this program, the turtle will only respond to exactly ``left`` or " 112 | "``right`` with no variation. Though ``Left`` or ``LEFT`` might seem the same" 113 | " as ``left`` to a human, that isn't the case when programming. Python has a " 114 | "few utility methods to help with that. A string has the methods " 115 | "``.strip()``, which removes whitespace and ``.lower()`` which makes " 116 | "everything lower-case." 117 | msgstr "" 118 | 119 | #: ../../../source/conditionals.rst:90 120 | msgid "" 121 | "Here are some examples to print out the effects of ``.strip()`` and " 122 | "``.lower()``::" 123 | msgstr "" 124 | 125 | #: ../../../source/conditionals.rst:99 126 | msgid "" 127 | "Try adding ``direction = direction.strip().lower()`` to the ``move()`` " 128 | "function, to see the effect. We often call this kind of code \"data " 129 | "munging\", and it is very common." 130 | msgstr "" 131 | 132 | #: ../../../source/conditionals.rst:103 133 | msgid "" 134 | "Can you add some extra input choices to make the turtle draw other things? " 135 | "How about ``hexagon``?" 136 | msgstr "" 137 | -------------------------------------------------------------------------------- /source/locale/ko/LC_MESSAGES/variables.po: -------------------------------------------------------------------------------- 1 | # SOME DESCRIPTIVE TITLE. 2 | # Copyright (C) 2012–2014, OpenTechSchool and contributors 3 | # This file is distributed under the same license as the Introduction to Programming with Python package. 4 | # 5 | # Translators: 6 | msgid "" 7 | msgstr "" 8 | "Project-Id-Version: Python for beginners\n" 9 | "Report-Msgid-Bugs-To: \n" 10 | "POT-Creation-Date: 2014-06-09 11:00+1000\n" 11 | "PO-Revision-Date: 2013-10-24 23:06+0000\n" 12 | "Last-Translator: Matthew Iversen \n" 13 | "Language-Team: Korean (http://www.transifex.com/projects/p/python-for-beginners/language/ko/)\n" 14 | "MIME-Version: 1.0\n" 15 | "Content-Type: text/plain; charset=UTF-8\n" 16 | "Content-Transfer-Encoding: 8bit\n" 17 | "Language: ko\n" 18 | "Plural-Forms: nplurals=1; plural=0;\n" 19 | 20 | # 016333f418f04abb99e1f153b93d1733 21 | #: ../../../source/variables.rst:2 22 | msgid "Variables" 23 | msgstr "" 24 | 25 | # 2a00a8448498495ba72c8e5c1b7be5a3 26 | #: ../../../source/variables.rst:5 27 | msgid "Introduction" 28 | msgstr "" 29 | 30 | # 11e299324f7f446fb7fc1fe39af9ea9f 31 | #: ../../../source/variables.rst:7 32 | msgid "" 33 | "Whew. Experimenting with the angles requires you to change three different " 34 | "places in the code each time. Imagine you'd want to experiment with all of " 35 | "the square sizes, let alone with rectangles! We can do better than that." 36 | msgstr "" 37 | 38 | # a2712e5a1bf24c91bf73db77f5094695 39 | #: ../../../source/variables.rst:11 40 | msgid "" 41 | "This is where **variables** come into play: You can tell Python that from " 42 | "now on, whenever you refer to a variable, you actually mean something else. " 43 | "That concept might be familiar from symbolic maths, where you would write: " 44 | "*Let x be 5.* Then *x \\* 2* will obviously be *10*." 45 | msgstr "" 46 | 47 | # fa0a962bd37d4e8eb7ba0ee69b28e8ee 48 | #: ../../../source/variables.rst:16 49 | msgid "In Python syntax, that very statement translates to::" 50 | msgstr "" 51 | 52 | # 986235ce1d8b44ebb5dd81ce1b1abd75 53 | #: ../../../source/variables.rst:20 54 | msgid "" 55 | "After that statement, if you do ``print(x)``, it will actually output its " 56 | "value --- 5. Well, can use that for your turtle too::" 57 | msgstr "" 58 | 59 | # 41ee9fc89f5b45a8b560e9c5ddf7b512 60 | #: ../../../source/variables.rst:25 61 | msgid "" 62 | "Variables can store all sorts of things, not just numbers. A typical other " 63 | "thing you want to have stored often is a **string** - a line of text. " 64 | "Strings are indicated with a starting and a leading ``\"`` (double quote). " 65 | "You'll learn about this and other types, as those are called in Python, and " 66 | "what you can do with them later on." 67 | msgstr "" 68 | 69 | # 6023dfa68c764ea991ca7a7912e7bceb 70 | #: ../../../source/variables.rst:31 71 | msgid "You can even use a variable to give the turtle a name::" 72 | msgstr "" 73 | 74 | # 6c986c3906d34cd2a73d98485fa4d3e0 75 | #: ../../../source/variables.rst:35 76 | msgid "" 77 | "Now every time you type ``timmy`` it knows you mean ``turtle``. You can " 78 | "still continue to use ``turtle`` as well::" 79 | msgstr "" 80 | 81 | # 855b759cf6614117812596f0572da969 82 | #: ../../../source/variables.rst:43 83 | msgid "A variable called angle" 84 | msgstr "" 85 | 86 | # 341a0b4eab9c4060983a009910f9912b 87 | # c7f79c6a0e3f438c8cbddaeac9e3b967 88 | #: ../../../source/variables.rst:46 ../../../source/variables.rst:85 89 | msgid "Exercise" 90 | msgstr "" 91 | 92 | # 98036cab6adc4843be4121ad8a525a46 93 | #: ../../../source/variables.rst:48 94 | msgid "" 95 | "If we have a variable called ``angle``, how could we use that to experiment " 96 | "much faster with our tilted squares program?" 97 | msgstr "" 98 | 99 | # 4f5e8724e9bf47bb9a308c96b099e1bd 100 | #: ../../../source/variables.rst:54 101 | msgid "Solution" 102 | msgstr "" 103 | 104 | # e5cc56f2272342e2a9817063d345d126 105 | #: ../../../source/variables.rst:74 106 | msgid "... and so on" 107 | msgstr "" 108 | 109 | # f88b19f8666e4f3699d3fa8a1d16eeeb 110 | #: ../../../source/variables.rst:77 111 | msgid "Bonus" 112 | msgstr "" 113 | 114 | # 1af525ffffc44dba842bbaac6875a109 115 | #: ../../../source/variables.rst:79 116 | msgid "Can you apply that principle to the size of the squares, too?" 117 | msgstr "" 118 | 119 | # 860b1520bc564aae8f16cbeaf5723c13 120 | #: ../../../source/variables.rst:82 121 | msgid "The house of santa claus" 122 | msgstr "" 123 | 124 | # 1d280501f67a473aad5e0d4531953a0d 125 | #: ../../../source/variables.rst:87 126 | msgid "Draw a house." 127 | msgstr "" 128 | 129 | # cf4fc858e79b449fbfe315cf438b5e39 130 | #: ../../../source/variables.rst:91 131 | msgid "" 132 | "You can calculate the length of the diagonal line with the Pythagorean " 133 | "theorem. That value is a good candidate to store in a variable. To calculate" 134 | " the square root of a number in Python, you'll need to import the *math* " 135 | "module and use the ``math.sqrt()`` function. The square of a number is " 136 | "calculated with the ``**`` operator::" 137 | msgstr "" 138 | -------------------------------------------------------------------------------- /README.rst: -------------------------------------------------------------------------------- 1 | Introduction to programming with Python 2 | *************************************** 3 | 4 | This workshop is an introduction to basic programming concepts and 5 | abstractions. It is laid out for hands-on workshops taking up roughly 4 hours. 6 | While we have tried to be compatible with Python 2 _and_ 3 wherever possible, 7 | we'd strongly encourage you to use Python 3. 8 | 9 | The initial version of this material was loosely based on the "Python für Kids" 10 | book by Gregor Lingl. It is conceptual-- rather than incidental --that it 11 | trades in idioms for learnability. We believe that beginners sometimes have to 12 | jump through one or another hoop to fully comprehend the scope and 13 | applicability of a concept. Every introduced abstraction solves another pain 14 | point in the life of a beginning programmer. 15 | 16 | HTML Version 17 | ============ 18 | 19 | You can view this workshop being hosted here: 20 | http://opentechschool.github.io/python-beginners/ 21 | 22 | The following sections are for people who want to contribute. 23 | 24 | Setup 25 | ===== 26 | 27 | This workshop is written in the reStructuredText_ format. The 28 | ``.rst`` files can be edited with a normal text editor. 29 | 30 | It can be rendered to several output formats using Sphinx_. To do that, you 31 | need to have the following Python packages installed: 32 | 33 | - Sphinx (and its dependencies docutils and Pygments) 34 | - Fabric 35 | - sphinx-intl 36 | - sphinx-bootstrap-theme 37 | 38 | You can install these with pip using ``pip install -r requirements.txt`` 39 | 40 | To push / pull translations from Transifex you will need the package 41 | ``transifex-client`` as well. 42 | 43 | Build 44 | ===== 45 | 46 | The fabric script ``fabfile.py`` contains tasks making the 47 | build process very easy. 48 | 49 | If you just want to render the HTML version, it's sufficient to run:: 50 | 51 | $ fab build:en 52 | 53 | Replace `en` with the language you'd like to build. 54 | 55 | This will create a directory ``_build``, containing the HTML version. 56 | 57 | You can view this in a browser by running ``fab serve`` and visiting the 58 | web address listed. 59 | 60 | Other `builders `_ can be 61 | passed as an argument. For instance use ``singlehtml`` to render the whole 62 | tutorial into a single HTML file:: 63 | 64 | $ fab build:en,singlehtml 65 | 66 | Translation 67 | =========== 68 | 69 | Translations should normally be done through Transifex. 70 | 71 | You can see the project on Transifex 72 | `here `_. 73 | 74 | After editing the tutorial, it is desirable to update sources for it. 75 | 76 | 1. New translation templates (.pot) must be created, then po translation 77 | files are updated (or created for the first time) - ``fab gen_pots`` 78 | 2. If you wish to upload new sources to transifex, you should use their 79 | cli client. ``tx push -s``. 80 | 3. To pull down translations for a particular language, use e.g. 81 | ``tx pull -l de``, for de (german) or others. 82 | 4. ``fab build:de`` will compile po files, and build the docs for that 83 | language. 84 | 85 | It is also possible to edit and update po files manually, you can check out 86 | the other fab command (``fab list``) for help with that. 87 | 88 | .. note:: only .po files should be committed to version control. .pot and .mo 89 | files are built automatically. 90 | 91 | Deploy 92 | ====== 93 | 94 | The workshop is deployed as a `GitHub Page`_. A good way to do 95 | that is described `right here `_. To simplify 96 | this process, you can use a nifty fabric target:: 97 | 98 | $ fab setup 99 | 100 | This recreates the ``_build/html`` folder, cloning the folder to the 101 | ``gh-pages`` branch of this repo. Then you should build updates for the 102 | desired language. Then `cd` into this folder, and git push the updates to 103 | update the branch. Like so:: 104 | 105 | $ fab build:en 106 | $ cd _build/html 107 | $ git status 108 | $ git commit --all 109 | $ git push 110 | 111 | Credits 112 | ======= 113 | 114 | The material presented here is a collaborative work. It has been created 115 | largely by OpenTechSchool_ Python coaches. Every bit, from exercises to 116 | translations, has been contributed by the community. After every workshop 117 | where this material is used we try to gather feedback on how to improve the 118 | material. 119 | 120 | License 121 | ======= 122 | 123 | This work is licensed under the Creative Commons Attribution-ShareAlike 124 | 3.0 Unported License. To view a copy of this license, visit 125 | http://creativecommons.org/licenses/by-sa/3.0/ or send a letter to 126 | Creative Commons, 444 Castro Street, Suite 900, Mountain View, 127 | California, 94041, USA. 128 | 129 | .. _OpenTechSchool: http://opentechschool.org 130 | .. _reStructuredText: http://docutils.sourceforge.net/docs/ 131 | .. _Sphinx: http://sphinx.pocoo.org/index.html 132 | .. _GitHub Page: https://help.github.com/categories/20/articles 133 | -------------------------------------------------------------------------------- /source/loops.rst: -------------------------------------------------------------------------------- 1 | Loops 2 | ***** 3 | 4 | Introduction 5 | ============ 6 | 7 | Something you might have noticed: our programs often feature repetition. 8 | Python has a powerful concept it makes use of called looping 9 | (jargon: *iteration*), which we can use to cut out our reptitive code! 10 | For now, **try this easy example**:: 11 | 12 | for name in "John", "Sam", "Jill": 13 | print("Hello " + name) 14 | 15 | This is incredibly helpful if we want to do something multiple times --- say, 16 | drawing the individual border lines of a shape --- but only want to write that 17 | action once. Here's another version of a loop:: 18 | 19 | for i in range(10): 20 | print(i) 21 | 22 | Notice how we write only one line of code using ``i``, but it takes on 10 23 | different values? 24 | 25 | The :samp:`range(n)` function can be considered a shorthand 26 | for ``0, 1, 2, ..., n-1``. If you want to know more about it, you can use 27 | the help in the Python shell by typing ``help(range)``. 28 | Use the :kbd:`q` key to exit the help again. 29 | 30 | You can also loop over elements of your choice:: 31 | 32 | total = 0 33 | for i in 5, 7, 11, 13: 34 | print(i) 35 | total = total + i 36 | 37 | print(total) 38 | 39 | Write this example out and run it with python, to check it works how you might 40 | expect. 41 | 42 | .. note:: 43 | 44 | Notice how above, the lines of code that are *looped*, are the ones that 45 | are *indented*. This is an important concept in Python - that's how it 46 | knows which lines should be used in the ``for`` loop, and which come 47 | after, as part of the rest of your program. Use four spaces (hitting tab) 48 | to indent your code. 49 | 50 | Sometimes you want to repeat some code a number of times, but don't care about 51 | the value of the ``i`` variable; so it can be good practice to replace it 52 | with ``_`` instead. This signifies that we don't care about its value, or 53 | don't wish to use it. Here's a simple example:: 54 | 55 | for _ in range(10): 56 | print("Hello!") 57 | 58 | You may or may not be wondering about the variable ``i`` - why is it used all 59 | the time above? Well, it simply stands for "index" and is one of the most 60 | common variable names ever found in code. But if you are looping over something 61 | other than just numbers, be sure to name it something better! For instance:: 62 | 63 | for drink in list_of_beverages: 64 | print("Would you like a " + drink + "?") 65 | 66 | This is immediately clearer to understand than if we had used ``i`` 67 | instead of ``drink``. 68 | 69 | Drawing a dashed line 70 | ===================== 71 | 72 | Exercise 73 | -------- 74 | 75 | Draw a dashed line. You can move the turtle without the turtle drawing its 76 | movement by using the ``turtle.penup()`` function; to tell it to draw again, 77 | use ``turtle.pendown()``. 78 | 79 | .. image:: /images/dashed.png 80 | 81 | .. rst-class:: solution 82 | 83 | Solution 84 | -------- 85 | 86 | :: 87 | 88 | for i in range(10): 89 | turtle.forward(15) 90 | turtle.penup() 91 | turtle.forward(5) 92 | turtle.pendown() 93 | 94 | Bonus 95 | ----- 96 | 97 | Can you make the dashes become larger as the line progresses? 98 | 99 | .. image:: /images/dashedprogressing.png 100 | 101 | .. hint:: 102 | 103 | Feeling lost? Inspect ``i`` at every run of the loop:: 104 | 105 | for i in range(10): 106 | print(i) 107 | # write more code here 108 | 109 | Can you utilize ``i`` --- commonly called the **index** variable or loop 110 | variable --- to get increasing step sizes? 111 | 112 | Comments 113 | ======== 114 | 115 | In the example above, the line that starts with a ``#`` is called a 116 | comment. In Python, anything that goes on a line after ``#`` is ignored 117 | by the computer. Use comments to explain what your program does, 118 | without changing the behaviour for the computer. They can also be used 119 | to easily and temporarily disable, or "comment out" some lines of code. 120 | 121 | Comments can also go at the end of a line, like this:: 122 | 123 | turtle.left(20) # tilt our next square slightly 124 | 125 | More Efficient Squares 126 | ====================== 127 | 128 | Exercise 129 | -------- 130 | 131 | The squares we were drawing at the start of this tutorial had a lot of 132 | repeated lines of code. Can you write out a square drawing program in fewer 133 | lines by utilizing loops? 134 | 135 | .. rst-class:: solution 136 | 137 | Solution 138 | -------- 139 | 140 | :: 141 | 142 | for _ in range(4): 143 | turtle.forward(100) 144 | turtle.left(90) 145 | 146 | Bonus 147 | ----- 148 | 149 | Try *nesting* loops, by putting one right under (*inside*) the other, with some 150 | drawing code that's inside both. Here's what it can look like:: 151 | 152 | for ...: 153 | for ...: 154 | # drawing code inside the inner loop goes here 155 | ... 156 | # you can put some code here to move 157 | # around after! 158 | ... 159 | 160 | Replace the ``...``'s with your own code, and see if you can come up with 161 | something funny or interesting! :sup:`Mistakes are encouraged!` 162 | -------------------------------------------------------------------------------- /source/functions.rst: -------------------------------------------------------------------------------- 1 | User-defined functions 2 | ********************** 3 | 4 | Introduction 5 | ============ 6 | 7 | Programmers can deal with some pretty complex and abstract problems, but one 8 | sign of a good programmer is that they're lazy. They only like to deal with one 9 | thing at a time. So you need a way to break up problems into smaller, discrete 10 | pieces, which lets you focus on just the piece you want to. 11 | 12 | Functions are one way to do this abstraction in Python. Let's take 13 | ``turtle.reset()`` for example. ``reset`` is a function we call on our ``turtle``, and 14 | it is actually an abstraction for a number of steps, namely: 15 | 16 | * Erase the drawing board. 17 | * Set the width and color back to default. 18 | * Move the turtle back to its initial position. 19 | 20 | But because all the code is contained in the function, we don't have to worry about these 21 | details. We can simply *call* this function, and know it will do what it says for us. 22 | 23 | So - how to write your own? 24 | 25 | A function can be defined with the ``def`` keyword in Python:: 26 | 27 | def line_without_moving(): 28 | turtle.forward(50) 29 | turtle.backward(50) 30 | 31 | This function we defined is called ``line_without_moving`` and it is 32 | an abstraction for two turtle steps - a move forward and a move 33 | backward. 34 | 35 | To use it (or as it is usually called, "to call it"), write its name 36 | followed by parentheses:: 37 | 38 | line_without_moving() 39 | turtle.right(90) 40 | line_without_moving() 41 | turtle.right(90) 42 | line_without_moving() 43 | turtle.right(90) 44 | line_without_moving() 45 | 46 | We could write more functions to remove some of the repetition:: 47 | 48 | def star_arm(): 49 | line_without_moving() 50 | turtle.right(360 / 5) 51 | 52 | for _ in range(5): 53 | star_arm() 54 | 55 | .. important:: 56 | 57 | Python uses *indenting with whitespace* to identify blocks of code 58 | that belong together. In Python a block (like the function 59 | definitions shown above) is introduced with a colon at the end of the 60 | line and subsequent commands are indented --- usually 4 spaces 61 | further in. The block ends with the first line that isn't indented. 62 | 63 | This is different to many other programming languages, which use 64 | special characters (like curly braces ``{}``) to group blocks of 65 | code together. 66 | 67 | Never use tab characters to indent your blocks, only spaces. You 68 | can -- and should -- configure your editor to put 4 spaces when you 69 | press the tab key. The problem with using tab characters is that 70 | other python programmers use spaces, and if both are used in the 71 | same file python will read it wrong (in the best place, it will 72 | complain, and in the worst case, weird, hard to debug bugs will 73 | happen). 74 | 75 | A function for a square 76 | ======================= 77 | 78 | Exercise 79 | -------- 80 | 81 | Write a function that draws a square. Could you use this function to improve the 82 | tilted squares program? If you change the program to use a function, is it easier 83 | to experiment with? 84 | 85 | .. rst-class:: solution 86 | 87 | Solution 88 | -------- 89 | 90 | :: 91 | 92 | def tilted_square(): 93 | turtle.left(20) # now we can change the angle only here 94 | for _ in range(4): 95 | turtle.forward(50) 96 | turtle.left(90) 97 | 98 | tilted_square() 99 | tilted_square() 100 | tilted_square() 101 | 102 | # bonus: you could have a separate function for drawing a square, 103 | # which might be useful later: 104 | 105 | def square(): 106 | for _ in range(4): 107 | turtle.forward(50) 108 | turtle.left(90) 109 | 110 | def tilted_square(): 111 | turtle.left(20) 112 | square() 113 | 114 | # etc 115 | 116 | A function for a hexagon 117 | ======================== 118 | 119 | Exercise 120 | -------- 121 | 122 | Write a function that draws a hexagon. 123 | 124 | .. image:: /images/hexagon.png 125 | 126 | Now combine that function into a honeycomb. Just make it with a single layer like this: 127 | 128 | .. image:: /images/honeycomb.png 129 | 130 | Give it a good go! 131 | 132 | .. hint:: 133 | 134 | Make sure your hexagon function returns your turtle to exactly the same 135 | position and angle it was before it was asked to draw the hexagon. This 136 | makes it easier to reason about. 137 | 138 | 139 | .. rst-class:: solution 140 | 141 | Solution 142 | -------- 143 | 144 | :: 145 | 146 | def hexagon(): 147 | for _ in range(6): 148 | turtle.forward(100) 149 | turtle.left(60) 150 | 151 | for _ in range (6): 152 | hexagon() 153 | turtle.forward(100) 154 | turtle.right(60) 155 | 156 | You could also put the ``turtle.forward(100); turtle.right(60)`` portion in the 157 | function, but you better not call it ``hexagon`` in that case. That's 158 | misleading because it actually draws a hexagon and then advances to a position 159 | where another hexagon would make sense in order to draw a honeycomb. If you 160 | ever wanted to reuse your hexagon function outside of honeycombs, that would be 161 | confusing. 162 | -------------------------------------------------------------------------------- /source/locale/en/LC_MESSAGES/where_to_go.po: -------------------------------------------------------------------------------- 1 | # 2 | msgid "" 3 | msgstr "" 4 | "Project-Id-Version: Introduction to Programming with Python 0.1\n" 5 | "Report-Msgid-Bugs-To: \n" 6 | "POT-Creation-Date: 2013-10-25 09:37\n" 7 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 8 | "Last-Translator: FULL NAME \n" 9 | "Language-Team: LANGUAGE \n" 10 | "MIME-Version: 1.0\n" 11 | "Content-Type: text/plain; charset=UTF-8\n" 12 | "Content-Transfer-Encoding: 8bit\n" 13 | 14 | #: ../../../source/where_to_go.rst:2 15 | msgid "Where to go from here" 16 | msgstr "" 17 | 18 | #: ../../../source/where_to_go.rst:5 19 | msgid "Learning Python" 20 | msgstr "" 21 | 22 | #: ../../../source/where_to_go.rst:7 23 | msgid "" 24 | "Hopefully this tutorial has tought you just enough python to get you on your" 25 | " feet. However, there is much more that you can learn! Even professional " 26 | "programmers will always be trying to learn more about their language and how" 27 | " to code excellently with it." 28 | msgstr "" 29 | 30 | #: ../../../source/where_to_go.rst:14 31 | msgid "Books and Tutorials" 32 | msgstr "" 33 | 34 | #: ../../../source/where_to_go.rst:16 35 | msgid "" 36 | "If you like learning from a book, there are heaps of good ones, and even " 37 | "many that can be read freely on the web!" 38 | msgstr "" 39 | 40 | #: ../../../source/where_to_go.rst:19 41 | msgid "" 42 | "`OTS Python Portal`_ - Check the rest of our tutorials, and look out for " 43 | "future workshops!" 44 | msgstr "" 45 | 46 | #: ../../../source/where_to_go.rst:21 47 | msgid "" 48 | "`O'Reilly`_ publishes hundreds of books and ebooks, on python and many other" 49 | " technologies (check out Learning Python, 5th edition)." 50 | msgstr "" 51 | 52 | #: ../../../source/where_to_go.rst:23 53 | msgid "" 54 | "`Invent with Python`_ takes a practical approach, with three different " 55 | "ebooks that can be read online for free." 56 | msgstr "" 57 | 58 | #: ../../../source/where_to_go.rst:25 59 | msgid "" 60 | "`Learn Python the Hard Way`_ is a step by step full tutorial on the " 61 | "language, done in a unique style." 62 | msgstr "" 63 | 64 | #: ../../../source/where_to_go.rst:27 65 | msgid "`Dive into Python 3`_ is another great book available online for free!" 66 | msgstr "" 67 | 68 | #: ../../../source/where_to_go.rst:28 69 | msgid "Last but not least, python.org has `Its own tutorial!`_" 70 | msgstr "" 71 | 72 | #: ../../../source/where_to_go.rst:40 73 | msgid "Online learning courses" 74 | msgstr "" 75 | 76 | #: ../../../source/where_to_go.rst:42 77 | msgid "" 78 | "You wouldn't believe what you can do on the web these days. There are many " 79 | "courses on programming around!" 80 | msgstr "" 81 | 82 | #: ../../../source/where_to_go.rst:45 83 | msgid "" 84 | "`Edx`_ - with top universities like Stanford, MIT, Harvard and Berkley " 85 | "giving out interactive courses for free, it's hard to turn this down. You'll" 86 | " have to look for ones coming up soon!" 87 | msgstr "" 88 | 89 | #: ../../../source/where_to_go.rst:48 90 | msgid "" 91 | "`Coursera`_ is very similar to Edx, with even more courses, and some that " 92 | "can be taken at any time." 93 | msgstr "" 94 | 95 | #: ../../../source/where_to_go.rst:50 96 | msgid "" 97 | "`CodeAcademy`_ - luckily this one has a python-specific course that can be " 98 | "taken at any time, and many other practical language courses." 99 | msgstr "" 100 | 101 | #: ../../../source/where_to_go.rst:62 102 | msgid "What to do with Python" 103 | msgstr "" 104 | 105 | #: ../../../source/where_to_go.rst:64 106 | msgid "" 107 | "Well, that's a tough one! See, practically anything you can think of " 108 | "involving some electronics - from your TV remote, to a smartphone, to the " 109 | "backend of a popular web service, to the scheduling of airport landings, to " 110 | "the software you use everyday - it all involves some programming somewhere!" 111 | msgstr "" 112 | 113 | #: ../../../source/where_to_go.rst:69 114 | msgid "" 115 | "And not only is it a big field practically, but also technically and " 116 | "academically. As soon as you have a basic understanding of a general " 117 | "language like python, you can start working on all manner of subjects: web " 118 | "frontends, web backend services, data analysis and statistics, Artificial " 119 | "Intelligence, GUI design, robotics, software development of all kinds, " 120 | "online transactions, automation of everything, and many more." 121 | msgstr "" 122 | 123 | #: ../../../source/where_to_go.rst:76 124 | msgid "" 125 | "We wouldn't blame if that all sounds daunting, so here's some practical " 126 | "advice, that takes advantage of how wide a field \"programming\" is:" 127 | msgstr "" 128 | 129 | #: ../../../source/where_to_go.rst:79 130 | msgid "**Apply your new skills to whatever you're passionate about.**" 131 | msgstr "" 132 | 133 | #: ../../../source/where_to_go.rst:81 134 | msgid "" 135 | "Whether that's starting a new business, helping you do some task involving " 136 | "data faster, putting up an online site, calculating advantages in a game you" 137 | " play, creating art and music, or anything else, finding out how to use " 138 | "programming to help with whatever floats your boat will make learning much " 139 | "more exciting and relevant. Feel free to ask someone more experienced if you" 140 | " have no idea where to start, but always mention what makes you tick!" 141 | msgstr "" 142 | -------------------------------------------------------------------------------- /source/locale/fr/LC_MESSAGES/where_to_go.po: -------------------------------------------------------------------------------- 1 | # 2 | msgid "" 3 | msgstr "" 4 | "Project-Id-Version: Introduction to Programming with Python 0.1\n" 5 | "Report-Msgid-Bugs-To: \n" 6 | "POT-Creation-Date: 2013-10-25 09:14\n" 7 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 8 | "Last-Translator: FULL NAME \n" 9 | "Language-Team: LANGUAGE \n" 10 | "MIME-Version: 1.0\n" 11 | "Content-Type: text/plain; charset=UTF-8\n" 12 | "Content-Transfer-Encoding: 8bit\n" 13 | 14 | #: ../../../source/where_to_go.rst:2 15 | msgid "Where to go from here" 16 | msgstr "" 17 | 18 | #: ../../../source/where_to_go.rst:5 19 | msgid "Learning Python" 20 | msgstr "" 21 | 22 | #: ../../../source/where_to_go.rst:7 23 | msgid "" 24 | "Hopefully this tutorial has tought you just enough python to get you on your" 25 | " feet. However, there is much more that you can learn! Even professional " 26 | "programmers will always be trying to learn more about their language and how" 27 | " to code excellently with it." 28 | msgstr "" 29 | 30 | #: ../../../source/where_to_go.rst:14 31 | msgid "Books and Tutorials" 32 | msgstr "" 33 | 34 | #: ../../../source/where_to_go.rst:16 35 | msgid "" 36 | "If you like learning from a book, there are heaps of good ones, and even " 37 | "many that can be read freely on the web!" 38 | msgstr "" 39 | 40 | #: ../../../source/where_to_go.rst:19 41 | msgid "" 42 | "`OTS Python Portal`_ - Check the rest of our tutorials, and look out for " 43 | "future workshops!" 44 | msgstr "" 45 | 46 | #: ../../../source/where_to_go.rst:21 47 | msgid "" 48 | "`O'Reilly`_ publishes hundreds of books and ebooks, on python and many other" 49 | " technologies (check out Learning Python, 5th edition)." 50 | msgstr "" 51 | 52 | #: ../../../source/where_to_go.rst:23 53 | msgid "" 54 | "`Invent with Python`_ takes a practical approach, with three different " 55 | "ebooks that can be read online for free." 56 | msgstr "" 57 | 58 | #: ../../../source/where_to_go.rst:25 59 | msgid "" 60 | "`Learn Python the Hard Way`_ is a step by step full tutorial on the " 61 | "language, done in a unique style." 62 | msgstr "" 63 | 64 | #: ../../../source/where_to_go.rst:27 65 | msgid "`Dive into Python 3`_ is another great book available online for free!" 66 | msgstr "" 67 | 68 | #: ../../../source/where_to_go.rst:28 69 | msgid "Last but not least, python.org has `Its own tutorial!`_" 70 | msgstr "" 71 | 72 | #: ../../../source/where_to_go.rst:40 73 | msgid "Online learning courses" 74 | msgstr "" 75 | 76 | #: ../../../source/where_to_go.rst:42 77 | msgid "" 78 | "You wouldn't believe what you can do on the web these days. There are many " 79 | "courses on programming around!" 80 | msgstr "" 81 | 82 | #: ../../../source/where_to_go.rst:45 83 | msgid "" 84 | "`Edx`_ - with top universities like Stanford, MIT, Harvard and Berkley " 85 | "giving out interactive courses for free, it's hard to turn this down. You'll" 86 | " have to look for ones coming up soon!" 87 | msgstr "" 88 | 89 | #: ../../../source/where_to_go.rst:48 90 | msgid "" 91 | "`Coursera`_ is very similar to Edx, with even more courses, and some that " 92 | "can be taken at any time." 93 | msgstr "" 94 | 95 | #: ../../../source/where_to_go.rst:50 96 | msgid "" 97 | "`CodeAcademy`_ - luckily this one has a python-specific course that can be " 98 | "taken at any time, and many other practical language courses." 99 | msgstr "" 100 | 101 | #: ../../../source/where_to_go.rst:62 102 | msgid "What to do with Python" 103 | msgstr "" 104 | 105 | #: ../../../source/where_to_go.rst:64 106 | msgid "" 107 | "Well, that's a tough one! See, practically anything you can think of " 108 | "involving some electronics - from your TV remote, to a smartphone, to the " 109 | "backend of a popular web service, to the scheduling of airport landings, to " 110 | "the software you use everyday - it all involves some programming somewhere!" 111 | msgstr "" 112 | 113 | #: ../../../source/where_to_go.rst:69 114 | msgid "" 115 | "And not only is it a big field practically, but also technically and " 116 | "academically. As soon as you have a basic understanding of a general " 117 | "language like python, you can start working on all manner of subjects: web " 118 | "frontends, web backend services, data analysis and statistics, Artificial " 119 | "Intelligence, GUI design, robotics, software development of all kinds, " 120 | "online transactions, automation of everything, and many more." 121 | msgstr "" 122 | 123 | #: ../../../source/where_to_go.rst:76 124 | msgid "" 125 | "We wouldn't blame if that all sounds daunting, so here's some practical " 126 | "advice, that takes advantage of how wide a field \"programming\" is:" 127 | msgstr "" 128 | 129 | #: ../../../source/where_to_go.rst:79 130 | msgid "**Apply your new skills to whatever you're passionate about.**" 131 | msgstr "" 132 | 133 | #: ../../../source/where_to_go.rst:81 134 | msgid "" 135 | "Whether that's starting a new business, helping you do some task involving " 136 | "data faster, putting up an online site, calculating advantages in a game you" 137 | " play, creating art and music, or anything else, finding out how to use " 138 | "programming to help with whatever floats your boat will make learning much " 139 | "more exciting and relevant. Feel free to ask someone more experienced if you" 140 | " have no idea where to start, but always mention what makes you tick!" 141 | msgstr "" 142 | -------------------------------------------------------------------------------- /source/locale/es_CL/LC_MESSAGES/logical_operators.po: -------------------------------------------------------------------------------- 1 | # SOME DESCRIPTIVE TITLE. 2 | # Copyright (C) 2012–2014, OpenTechSchool and contributors 3 | # This file is distributed under the same license as the Introduction to Programming with Python package. 4 | # 5 | # Translators: 6 | # Patricio Alejandro Urrutia Arestizábal , 2013 7 | msgid "" 8 | msgstr "" 9 | "Project-Id-Version: Python for beginners\n" 10 | "Report-Msgid-Bugs-To: \n" 11 | "POT-Creation-Date: 2014-06-09 11:00+1000\n" 12 | "PO-Revision-Date: 2013-11-17 18:55+0000\n" 13 | "Last-Translator: Patricio Alejandro Urrutia Arestizábal \n" 14 | "Language-Team: Spanish (Chile) (http://www.transifex.com/projects/p/python-for-beginners/language/es_CL/)\n" 15 | "MIME-Version: 1.0\n" 16 | "Content-Type: text/plain; charset=UTF-8\n" 17 | "Content-Transfer-Encoding: 8bit\n" 18 | "Language: es_CL\n" 19 | "Plural-Forms: nplurals=2; plural=(n != 1);\n" 20 | 21 | # 2f20df833f124f9c85714161761b61a0 22 | #: ../../../source/logical_operators.rst:2 23 | msgid "Logical operators" 24 | msgstr "Opreadores Lógicos" 25 | 26 | # f311ca6659b4437e989dee0b026e81c5 27 | #: ../../../source/logical_operators.rst:5 28 | msgid "Introduction" 29 | msgstr "Introducción" 30 | 31 | # a64bdf21929b492493f49955995ab7bc 32 | #: ../../../source/logical_operators.rst:7 33 | msgid "" 34 | "Conditionals are a nice way to make decisions by asking if something equals " 35 | "*True* or not. But often one condition is not enough. We may want to take " 36 | "the opposite of our result. Or for instance if we want to make a decision " 37 | "upon ``turtle.xcor()`` and ``turtle.ycor()`` we have to combine them. This " 38 | "can be done with logical operators." 39 | msgstr "Los condicionales son una muy buena forma de tomar decisiones preguntando si algo es igual a *True* o no. Pero a menudo una condición no es suficiente. Podríamos querer tomar lo opuesto a nuestro resultado. O por ejemplo si queremos tomar una decisión sobre ``turtle.xcor()`` y ``turtle.ycor()`` debemos combinarlos. Esto puede realizarse con operadores lógicos." 40 | 41 | # 91aa730b80734d2486904a10e87f6973 42 | #: ../../../source/logical_operators.rst:14 43 | msgid "Negation of a statement" 44 | msgstr "Negación de una sentencia" 45 | 46 | # 16dd9203364c46d3a5f8c59cd8891fb2 47 | #: ../../../source/logical_operators.rst:16 48 | msgid "" 49 | "If we want something to be *False* we can use ``not``. It is a logical " 50 | "operator::" 51 | msgstr "Si queremos que algo sea *False* podemos usar ``not``. Es un operador lógico::" 52 | 53 | # 98497a179d5d4026bd2f78d00bef5db5 54 | # 13525c7015f848e89385f50b6344f0e5 55 | #: ../../../source/logical_operators.rst:26 56 | #: ../../../source/logical_operators.rst:66 57 | msgid "Exercise" 58 | msgstr "Ejercicio" 59 | 60 | # 35d690f787ac4b7a94541491e7069e38 61 | #: ../../../source/logical_operators.rst:28 62 | msgid "" 63 | "The turtle gives us a useful function to know if it is drawing or not: " 64 | "``turtle.isdown()``. This function returns *True* if the turtle is drawing." 65 | " As we have seen earlier, the function ``turtle.penup()`` and " 66 | "``turtle.pendown()`` toggle between drawing while moving, or just moving " 67 | "without a trace." 68 | msgstr "El programa turtle nos da una función muy útil para saber si se está dibujando o no: ``turtle.isdown()``. Esta función retorna *True* si la tortuga está dibujando. Como hemos visto anteriormente, la función ``turtle.penup()`` y ``turtle.pendown()`` conmuta entre dibujar mientras se está moviendo, o solo moverse sin dejar trazo." 69 | 70 | # 3d050f537f894d0092f7bc4ebb7aecc0 71 | #: ../../../source/logical_operators.rst:33 72 | msgid "Can we write a function that only goes forward if the pen is up?" 73 | msgstr "Podemos escribir una función que permita ir adelante solamente si el lápiz está levantado?" 74 | 75 | # 8ec37a98bbce4ccd9ce82d3d6657f779 76 | # 79c8613a80fb446d937f63207d57126b 77 | #: ../../../source/logical_operators.rst:38 78 | #: ../../../source/logical_operators.rst:75 79 | msgid "Solution" 80 | msgstr "Solución" 81 | 82 | # 479b73f64ea14a6984e626cfb3c1b620 83 | #: ../../../source/logical_operators.rst:48 84 | msgid "This and that or something else" 85 | msgstr "Esto, aquello u otra cosa" 86 | 87 | # d77af2e96f3840fe90850c25a0981881 88 | #: ../../../source/logical_operators.rst:50 89 | msgid "" 90 | "Two easy to understand operators are ``and`` and ``or``. They do exactly " 91 | "what they sound like:::" 92 | msgstr "Dos operadores fáciles de entender son ``and`` y ``or``. Ellos hacen exactamente lo que dicen sus nombres:::" 93 | 94 | # a1e51836541b45ea81132528be3d7323 95 | #: ../../../source/logical_operators.rst:62 96 | msgid "" 97 | "You are not restricted to one logical operator. You can combine as may as " 98 | "you want." 99 | msgstr "No está restringido a un operador lógico. Puede combinar tantos como quiera." 100 | 101 | # 8b46de8719184531b8b89b8a50b410d8 102 | #: ../../../source/logical_operators.rst:68 103 | msgid "" 104 | "Earlier we put the turtle in a circular prison. This time let's make it a " 105 | "box. If the turtle goes more than 100 in the X *or* Y axis then we turn the " 106 | "turtle back around to the center." 107 | msgstr "Antes pusimos a la tortuga en una prisión circular. Ahora hagamos la prisión cuadrada. Si la tortuga intenta ir a más de 100 en el eje X *or* en el eje Y, entonces retornemos a la tortuga de vuelta al centro." 108 | -------------------------------------------------------------------------------- /source/locale/en/LC_MESSAGES/conditional_loops.po: -------------------------------------------------------------------------------- 1 | # 2 | msgid "" 3 | msgstr "" 4 | "Project-Id-Version: Introduction to Programming with Python 0.1\n" 5 | "Report-Msgid-Bugs-To: \n" 6 | "POT-Creation-Date: 2013-10-25 09:37\n" 7 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 8 | "Last-Translator: FULL NAME \n" 9 | "Language-Team: LANGUAGE \n" 10 | "MIME-Version: 1.0\n" 11 | "Content-Type: text/plain; charset=UTF-8\n" 12 | "Content-Transfer-Encoding: 8bit\n" 13 | 14 | #: ../../../source/conditional_loops.rst:2 15 | msgid "Conditional Loops" 16 | msgstr "" 17 | 18 | #: ../../../source/conditional_loops.rst:4 19 | msgid "Introduction" 20 | msgstr "" 21 | 22 | #: ../../../source/conditional_loops.rst:6 23 | msgid "" 24 | "Conditional loops are way to repeat something while a certain condition is " 25 | "satisfied, or **True**. If the condition is always satisfied (never becomes " 26 | "**False**), the loop can become infinite. If the condition starts off false," 27 | " the code in the loop will never run! In Python conditional loops are " 28 | "defined with the ``while`` statement::" 29 | msgstr "" 30 | 31 | #: ../../../source/conditional_loops.rst:23 32 | msgid "We call this part of the code the 'conditional': ``'.' not in word``" 33 | msgstr "" 34 | 35 | #: ../../../source/conditional_loops.rst:25 36 | msgid "" 37 | "Whether the conditional return True or not determines whether the code " 38 | "inside the ``while`` loop runs." 39 | msgstr "" 40 | 41 | #: ../../../source/conditional_loops.rst:28 42 | msgid "" 43 | "Read the code above, and see if you can summarise in your head what it what " 44 | "it do (what its final output will be)." 45 | msgstr "" 46 | 47 | #: ../../../source/conditional_loops.rst:31 48 | msgid "" 49 | "Then copy it into a file, say :file:`sentence.py` and run it - see exactly " 50 | "what it does. Does that match up with what you thought?" 51 | msgstr "" 52 | 53 | #: ../../../source/conditional_loops.rst:36 54 | msgid "" 55 | "If you are using Python 2, you will need to replace ``input`` with " 56 | "``raw_input`` to run the program correctly." 57 | msgstr "" 58 | 59 | #: ../../../source/conditional_loops.rst:40 60 | msgid "Turtle prison" 61 | msgstr "" 62 | 63 | #: ../../../source/conditional_loops.rst:43 64 | #: ../../../source/conditional_loops.rst:87 65 | msgid "Exercise" 66 | msgstr "" 67 | 68 | #: ../../../source/conditional_loops.rst:45 69 | msgid "" 70 | "The turtle has been up to its usual tricks again, robbing liqour stores and " 71 | "building up huge gambling debts. It's time for turtle to be put into a cell " 72 | "that it can't get out of." 73 | msgstr "" 74 | 75 | #: ../../../source/conditional_loops.rst:49 76 | msgid "" 77 | "Let's make a new version of ``forward()``. One that will turn the turtle " 78 | "around if it tries to go further than 100 from the origin. We'll need a " 79 | "``while`` loop, and some new turtle functions:" 80 | msgstr "" 81 | 82 | #: ../../../source/conditional_loops.rst:53 83 | msgid "``turtle.distance(0,0)`` - Distance of the turtle from the origin" 84 | msgstr "" 85 | 86 | #: ../../../source/conditional_loops.rst:54 87 | msgid "``turtle.towards(0,0)`` - The angle to get back to origin" 88 | msgstr "" 89 | 90 | #: ../../../source/conditional_loops.rst:55 91 | msgid "``turtle.setheading(angle)`` - Directly sets the turtle direction" 92 | msgstr "" 93 | 94 | #: ../../../source/conditional_loops.rst:57 95 | msgid "" 96 | "You could try playing with a turtle in the interpreter and using these " 97 | "functions to check exactly what they do, if you like." 98 | msgstr "" 99 | 100 | #: ../../../source/conditional_loops.rst:60 101 | msgid "" 102 | "Now you will need to implement the prison logic using these turtle " 103 | "functions, perhaps a ``while`` loop and a bit of conditional logic. It's a " 104 | "bit of a stretch but keep at it! Don't be afraid to talk it out with a coach" 105 | " or another student." 106 | msgstr "" 107 | 108 | #: ../../../source/conditional_loops.rst:66 109 | #: ../../../source/conditional_loops.rst:104 110 | msgid "Solution" 111 | msgstr "" 112 | 113 | #: ../../../source/conditional_loops.rst:80 114 | msgid "Draw a spiral" 115 | msgstr "" 116 | 117 | #: ../../../source/conditional_loops.rst:82 118 | msgid "" 119 | "Loops can be interrupted with the ``break`` statement. This is especially " 120 | "useful if you write an *infinite loop*, which is a loop where the " 121 | "conditional is always **True**." 122 | msgstr "" 123 | 124 | #: ../../../source/conditional_loops.rst:89 125 | msgid "" 126 | "Write a ``while`` loop with a condition that is always **True** to draw a " 127 | "spiral. Interrupt the loop when the turtle reaches a certain distance from " 128 | "the center. Use the function ``turtle.distance(x, y)`` to get the turtle's " 129 | "distance to the point defined by the coordinates ``x`` and ``y``." 130 | msgstr "" 131 | 132 | #: ../../../source/conditional_loops.rst:94 133 | msgid "" 134 | "To do this you will need the ``turtle.xcor()`` and ``turtle.ycor()`` " 135 | "functions, which return the position of the turtle in X and Y axes " 136 | "respectively." 137 | msgstr "" 138 | 139 | #: ../../../source/conditional_loops.rst:100 140 | msgid "" 141 | "To draw a spiral, the turtle has to rotate by a constant value and move " 142 | "forward by an increasing value." 143 | msgstr "" 144 | 145 | #: ../../../source/conditional_loops.rst:120 146 | msgid "Bonus" 147 | msgstr "" 148 | 149 | #: ../../../source/conditional_loops.rst:122 150 | msgid "" 151 | "Can you make a conditional for this loop, so you don't need the infinite " 152 | "loop ``while True`` or the ``break``? Which version do you find easier to " 153 | "understand?" 154 | msgstr "" 155 | -------------------------------------------------------------------------------- /source/locale/fr/LC_MESSAGES/conditional_loops.po: -------------------------------------------------------------------------------- 1 | # 2 | msgid "" 3 | msgstr "" 4 | "Project-Id-Version: Introduction to Programming with Python 0.1\n" 5 | "Report-Msgid-Bugs-To: \n" 6 | "POT-Creation-Date: 2013-10-25 09:14\n" 7 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 8 | "Last-Translator: FULL NAME \n" 9 | "Language-Team: LANGUAGE \n" 10 | "MIME-Version: 1.0\n" 11 | "Content-Type: text/plain; charset=UTF-8\n" 12 | "Content-Transfer-Encoding: 8bit\n" 13 | 14 | #: ../../../source/conditional_loops.rst:2 15 | msgid "Conditional Loops" 16 | msgstr "" 17 | 18 | #: ../../../source/conditional_loops.rst:4 19 | msgid "Introduction" 20 | msgstr "" 21 | 22 | #: ../../../source/conditional_loops.rst:6 23 | msgid "" 24 | "Conditional loops are way to repeat something while a certain condition is " 25 | "satisfied, or **True**. If the condition is always satisfied (never becomes " 26 | "**False**), the loop can become infinite. If the condition starts off false," 27 | " the code in the loop will never run! In Python conditional loops are " 28 | "defined with the ``while`` statement::" 29 | msgstr "" 30 | 31 | #: ../../../source/conditional_loops.rst:23 32 | msgid "We call this part of the code the 'conditional': ``'.' not in word``" 33 | msgstr "" 34 | 35 | #: ../../../source/conditional_loops.rst:25 36 | msgid "" 37 | "Whether the conditional return True or not determines whether the code " 38 | "inside the ``while`` loop runs." 39 | msgstr "" 40 | 41 | #: ../../../source/conditional_loops.rst:28 42 | msgid "" 43 | "Read the code above, and see if you can summarise in your head what it what " 44 | "it do (what its final output will be)." 45 | msgstr "" 46 | 47 | #: ../../../source/conditional_loops.rst:31 48 | msgid "" 49 | "Then copy it into a file, say :file:`sentence.py` and run it - see exactly " 50 | "what it does. Does that match up with what you thought?" 51 | msgstr "" 52 | 53 | #: ../../../source/conditional_loops.rst:36 54 | msgid "" 55 | "If you are using Python 2, you will need to replace ``input`` with " 56 | "``raw_input`` to run the program correctly." 57 | msgstr "" 58 | 59 | #: ../../../source/conditional_loops.rst:40 60 | msgid "Turtle prison" 61 | msgstr "" 62 | 63 | #: ../../../source/conditional_loops.rst:43 64 | #: ../../../source/conditional_loops.rst:87 65 | msgid "Exercise" 66 | msgstr "" 67 | 68 | #: ../../../source/conditional_loops.rst:45 69 | msgid "" 70 | "The turtle has been up to its usual tricks again, robbing liqour stores and " 71 | "building up huge gambling debts. It's time for turtle to be put into a cell " 72 | "that it can't get out of." 73 | msgstr "" 74 | 75 | #: ../../../source/conditional_loops.rst:49 76 | msgid "" 77 | "Let's make a new version of ``forward()``. One that will turn the turtle " 78 | "around if it tries to go further than 100 from the origin. We'll need a " 79 | "``while`` loop, and some new turtle functions:" 80 | msgstr "" 81 | 82 | #: ../../../source/conditional_loops.rst:53 83 | msgid "``turtle.distance(0,0)`` - Distance of the turtle from the origin" 84 | msgstr "" 85 | 86 | #: ../../../source/conditional_loops.rst:54 87 | msgid "``turtle.towards(0,0)`` - The angle to get back to origin" 88 | msgstr "" 89 | 90 | #: ../../../source/conditional_loops.rst:55 91 | msgid "``turtle.setheading(angle)`` - Directly sets the turtle direction" 92 | msgstr "" 93 | 94 | #: ../../../source/conditional_loops.rst:57 95 | msgid "" 96 | "You could try playing with a turtle in the interpreter and using these " 97 | "functions to check exactly what they do, if you like." 98 | msgstr "" 99 | 100 | #: ../../../source/conditional_loops.rst:60 101 | msgid "" 102 | "Now you will need to implement the prison logic using these turtle " 103 | "functions, perhaps a ``while`` loop and a bit of conditional logic. It's a " 104 | "bit of a stretch but keep at it! Don't be afraid to talk it out with a coach" 105 | " or another student." 106 | msgstr "" 107 | 108 | #: ../../../source/conditional_loops.rst:66 109 | #: ../../../source/conditional_loops.rst:104 110 | msgid "Solution" 111 | msgstr "" 112 | 113 | #: ../../../source/conditional_loops.rst:80 114 | msgid "Draw a spiral" 115 | msgstr "" 116 | 117 | #: ../../../source/conditional_loops.rst:82 118 | msgid "" 119 | "Loops can be interrupted with the ``break`` statement. This is especially " 120 | "useful if you write an *infinite loop*, which is a loop where the " 121 | "conditional is always **True**." 122 | msgstr "" 123 | 124 | #: ../../../source/conditional_loops.rst:89 125 | msgid "" 126 | "Write a ``while`` loop with a condition that is always **True** to draw a " 127 | "spiral. Interrupt the loop when the turtle reaches a certain distance from " 128 | "the center. Use the function ``turtle.distance(x, y)`` to get the turtle's " 129 | "distance to the point defined by the coordinates ``x`` and ``y``." 130 | msgstr "" 131 | 132 | #: ../../../source/conditional_loops.rst:94 133 | msgid "" 134 | "To do this you will need the ``turtle.xcor()`` and ``turtle.ycor()`` " 135 | "functions, which return the position of the turtle in X and Y axes " 136 | "respectively." 137 | msgstr "" 138 | 139 | #: ../../../source/conditional_loops.rst:100 140 | msgid "" 141 | "To draw a spiral, the turtle has to rotate by a constant value and move " 142 | "forward by an increasing value." 143 | msgstr "" 144 | 145 | #: ../../../source/conditional_loops.rst:120 146 | msgid "Bonus" 147 | msgstr "" 148 | 149 | #: ../../../source/conditional_loops.rst:122 150 | msgid "" 151 | "Can you make a conditional for this loop, so you don't need the infinite " 152 | "loop ``while True`` or the ``break``? Which version do you find easier to " 153 | "understand?" 154 | msgstr "" 155 | -------------------------------------------------------------------------------- /source/locale/de/LC_MESSAGES/logical_operators.po: -------------------------------------------------------------------------------- 1 | # SOME DESCRIPTIVE TITLE. 2 | # Copyright (C) 2012–2014, OpenTechSchool and contributors 3 | # This file is distributed under the same license as the Introduction to Programming with Python package. 4 | # 5 | # Translators: 6 | # Kristian Rother , 2013 7 | # Robert Lehmann , 2013 8 | # Benjamin Kampmann , 2013 9 | # Robert Lehmann , 2014 10 | msgid "" 11 | msgstr "" 12 | "Project-Id-Version: Python for beginners\n" 13 | "Report-Msgid-Bugs-To: \n" 14 | "POT-Creation-Date: 2014-06-09 11:00+1000\n" 15 | "PO-Revision-Date: 2014-02-24 23:06+0000\n" 16 | "Last-Translator: Robert Lehmann \n" 17 | "Language-Team: German (http://www.transifex.com/projects/p/python-for-beginners/language/de/)\n" 18 | "MIME-Version: 1.0\n" 19 | "Content-Type: text/plain; charset=UTF-8\n" 20 | "Content-Transfer-Encoding: 8bit\n" 21 | "Language: de\n" 22 | "Plural-Forms: nplurals=2; plural=(n != 1);\n" 23 | 24 | # 2f20df833f124f9c85714161761b61a0 25 | #: ../../../source/logical_operators.rst:2 26 | msgid "Logical operators" 27 | msgstr "Logische Operatoren" 28 | 29 | # f311ca6659b4437e989dee0b026e81c5 30 | #: ../../../source/logical_operators.rst:5 31 | msgid "Introduction" 32 | msgstr "Einführung" 33 | 34 | # a64bdf21929b492493f49955995ab7bc 35 | #: ../../../source/logical_operators.rst:7 36 | msgid "" 37 | "Conditionals are a nice way to make decisions by asking if something equals " 38 | "*True* or not. But often one condition is not enough. We may want to take " 39 | "the opposite of our result. Or for instance if we want to make a decision " 40 | "upon ``turtle.xcor()`` and ``turtle.ycor()`` we have to combine them. This " 41 | "can be done with logical operators." 42 | msgstr "Verzweigungen sind ein guter Weg um im Programm Entscheidungen zu treffen, indem geprüft wird ob etwas *True* ist oder nicht. Aber häufig reicht eine Bedingung allein nicht aus. Vielleicht möchtest Du auch das Gegenteil Deines Ergebnisses prüfen. Oder falls Du eine Entscheidung aufgrund von ``turtle.xcor()`` und ``turtle.ycor()`` treffen möchtest, musst Du beide verknüpfen. Das kannst Du mit logischen Operatoren erreichen." 43 | 44 | # 91aa730b80734d2486904a10e87f6973 45 | #: ../../../source/logical_operators.rst:14 46 | msgid "Negation of a statement" 47 | msgstr "Verneinung eines Ausdrucks" 48 | 49 | # 16dd9203364c46d3a5f8c59cd8891fb2 50 | #: ../../../source/logical_operators.rst:16 51 | msgid "" 52 | "If we want something to be *False* we can use ``not``. It is a logical " 53 | "operator::" 54 | msgstr "Wenn wir möchten, dass etwas *False* ist, können wir den logischen Operator ``not`` verwenden::" 55 | 56 | # 98497a179d5d4026bd2f78d00bef5db5 57 | # 13525c7015f848e89385f50b6344f0e5 58 | #: ../../../source/logical_operators.rst:26 59 | #: ../../../source/logical_operators.rst:66 60 | msgid "Exercise" 61 | msgstr "Übung" 62 | 63 | # 35d690f787ac4b7a94541491e7069e38 64 | #: ../../../source/logical_operators.rst:28 65 | msgid "" 66 | "The turtle gives us a useful function to know if it is drawing or not: " 67 | "``turtle.isdown()``. This function returns *True* if the turtle is drawing." 68 | " As we have seen earlier, the function ``turtle.penup()`` and " 69 | "``turtle.pendown()`` toggle between drawing while moving, or just moving " 70 | "without a trace." 71 | msgstr "Die Schildkröte enthält eine nützliche Funktion die sagt ob grade gezeichnet wird oder nicht; ``turtle.isdown()``. Diese Funktion liefert *True* falls die Schildkröte im Zeichenmodus ist. Wie wir bereits gesehen haben, schalten die Funktionen ``turtle.penup()`` und ``turtle.pendown()`` zwischen dem Modus zum Zeichnen beim Bewegen und dem Bewegungsmodus ohne Zeichnen hin und her." 72 | 73 | # 3d050f537f894d0092f7bc4ebb7aecc0 74 | #: ../../../source/logical_operators.rst:33 75 | msgid "Can we write a function that only goes forward if the pen is up?" 76 | msgstr "Können wir eine Funktion schreiben die nur vorwärts geht falls die Schildkröte nicht im Zeichenmodus ist?" 77 | 78 | # 8ec37a98bbce4ccd9ce82d3d6657f779 79 | # 79c8613a80fb446d937f63207d57126b 80 | #: ../../../source/logical_operators.rst:38 81 | #: ../../../source/logical_operators.rst:75 82 | msgid "Solution" 83 | msgstr "Lösung" 84 | 85 | # 479b73f64ea14a6984e626cfb3c1b620 86 | #: ../../../source/logical_operators.rst:48 87 | msgid "This and that or something else" 88 | msgstr "Dies und jenes oder etwas anderes" 89 | 90 | # d77af2e96f3840fe90850c25a0981881 91 | #: ../../../source/logical_operators.rst:50 92 | msgid "" 93 | "Two easy to understand operators are ``and`` and ``or``. They do exactly " 94 | "what they sound like:::" 95 | msgstr "Zwei einfach zu verstehende Operatoren sind ``and`` und ``or``. Sie tun genau das wonach sie sich anhören:::" 96 | 97 | # a1e51836541b45ea81132528be3d7323 98 | #: ../../../source/logical_operators.rst:62 99 | msgid "" 100 | "You are not restricted to one logical operator. You can combine as may as " 101 | "you want." 102 | msgstr "Du bist nicht darauf angewiesen nur einen logischen Operator zu verwenden. Du kannst so viele miteinander kombinieren wie Du möchtest." 103 | 104 | # 8b46de8719184531b8b89b8a50b410d8 105 | #: ../../../source/logical_operators.rst:68 106 | msgid "" 107 | "Earlier we put the turtle in a circular prison. This time let's make it a " 108 | "box. If the turtle goes more than 100 in the X *or* Y axis then we turn the " 109 | "turtle back around to the center." 110 | msgstr "Weiter oben haben wir die Schildkröte in einem kreisförmigen Gefängnis eingesperrt. Diesmal werden wir ein Quadrat dazu verwenden. Falls die Schildkröte sich mehr als 100 Einheiten entlang der x- *oder* y-Achse vom Mittelpunkt entfernt, drehen wir sie zurück zur Mitte um." 111 | -------------------------------------------------------------------------------- /source/locale/en/LC_MESSAGES/functions.po: -------------------------------------------------------------------------------- 1 | # 2 | msgid "" 3 | msgstr "" 4 | "Project-Id-Version: Introduction to Programming with Python 0.1\n" 5 | "Report-Msgid-Bugs-To: \n" 6 | "POT-Creation-Date: 2013-10-25 09:37\n" 7 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 8 | "Last-Translator: FULL NAME \n" 9 | "Language-Team: LANGUAGE \n" 10 | "MIME-Version: 1.0\n" 11 | "Content-Type: text/plain; charset=UTF-8\n" 12 | "Content-Transfer-Encoding: 8bit\n" 13 | 14 | #: ../../../source/functions.rst:2 15 | msgid "User-defined functions" 16 | msgstr "" 17 | 18 | #: ../../../source/functions.rst:5 19 | msgid "Introduction" 20 | msgstr "" 21 | 22 | #: ../../../source/functions.rst:7 23 | msgid "" 24 | "Programmers can deal with some pretty complex and abstract problems, but one" 25 | " sign of a good programmer is that they're lazy. They only like to deal with" 26 | " one thing at a time. So you need a way to break up problems into smaller, " 27 | "discrete pieces, which lets you focus on just the piece you want to." 28 | msgstr "" 29 | 30 | #: ../../../source/functions.rst:12 31 | msgid "" 32 | "Functions are one way to do this abstraction in Python. Let's take " 33 | "``turtle.reset()`` for example. ``reset`` is a function we call on our " 34 | "``turtle``, and it is actually an abstraction for a number of steps, namely:" 35 | msgstr "" 36 | 37 | #: ../../../source/functions.rst:16 38 | msgid "Erase the drawing board." 39 | msgstr "" 40 | 41 | #: ../../../source/functions.rst:17 42 | msgid "Set the width and color back to default." 43 | msgstr "" 44 | 45 | #: ../../../source/functions.rst:18 46 | msgid "Move the turtle back to its initial position." 47 | msgstr "" 48 | 49 | #: ../../../source/functions.rst:20 50 | msgid "" 51 | "But because all the code is contained in the function, we don't have to " 52 | "worry about these details. We can simply *call* this function, and know it " 53 | "will do what it says for us." 54 | msgstr "" 55 | 56 | #: ../../../source/functions.rst:23 57 | msgid "So - how to write your own?" 58 | msgstr "" 59 | 60 | #: ../../../source/functions.rst:25 61 | msgid "A function can be defined with the ``def`` keyword in Python::" 62 | msgstr "" 63 | 64 | #: ../../../source/functions.rst:31 65 | msgid "" 66 | "This function we defined is called ``line_without_moving`` and it is an " 67 | "abstraction for two turtle steps - a move forward and a move backward." 68 | msgstr "" 69 | 70 | #: ../../../source/functions.rst:35 71 | msgid "" 72 | "To use it (or as it is usually called, \"to call it\"), write its name " 73 | "followed by parentheses::" 74 | msgstr "" 75 | 76 | #: ../../../source/functions.rst:46 77 | msgid "We could write more functions to remove some of the repetition::" 78 | msgstr "" 79 | 80 | #: ../../../source/functions.rst:57 81 | msgid "" 82 | "Python uses *indenting with whitespace* to identify blocks of code that " 83 | "belong together. In Python a block (like the function definitions shown " 84 | "above) is introduced with a colon at the end of the line and subsequent " 85 | "commands are indented --- usually 4 spaces further in. The block ends with " 86 | "the first line that isn't indented." 87 | msgstr "" 88 | 89 | #: ../../../source/functions.rst:63 90 | msgid "" 91 | "This is different to many other programming languages, which use special " 92 | "characters (like curly braces ``{}``) to group blocks of code together." 93 | msgstr "" 94 | 95 | #: ../../../source/functions.rst:67 96 | msgid "" 97 | "Never use tab characters to indent your blocks, only spaces. You can -- and " 98 | "should -- configure your editor to put 4 spaces when you press the tab key. " 99 | "The problem with using tab characters is that other python programmers use " 100 | "spaces, and if both are used in the same file python will read it wrong (in " 101 | "the best place, it will complain, and in the worst case, weird, hard to " 102 | "debug bugs will happen)." 103 | msgstr "" 104 | 105 | #: ../../../source/functions.rst:76 106 | msgid "A function for a square" 107 | msgstr "" 108 | 109 | #: ../../../source/functions.rst:79 ../../../source/functions.rst:118 110 | msgid "Exercise" 111 | msgstr "" 112 | 113 | #: ../../../source/functions.rst:81 114 | msgid "" 115 | "Write a function that draws a square. Could you use this function to improve" 116 | " the tilted squares program? If you change the program to use a function, is" 117 | " it easier to experiment with?" 118 | msgstr "" 119 | 120 | #: ../../../source/functions.rst:86 ../../../source/functions.rst:137 121 | msgid "Solution" 122 | msgstr "" 123 | 124 | #: ../../../source/functions.rst:115 125 | msgid "A function for a hexagon" 126 | msgstr "" 127 | 128 | #: ../../../source/functions.rst:120 129 | msgid "Write a function that draws a hexagon." 130 | msgstr "" 131 | 132 | #: ../../../source/functions.rst:124 133 | msgid "" 134 | "Now combine that function into a honeycomb. Just make it with a single layer" 135 | " like this:" 136 | msgstr "" 137 | 138 | #: ../../../source/functions.rst:128 139 | msgid "Give it a good go!" 140 | msgstr "" 141 | 142 | #: ../../../source/functions.rst:132 143 | msgid "" 144 | "Make sure your hexagon function returns your turtle to exactly the same " 145 | "position and angle it was before it was asked to draw the hexagon. This " 146 | "makes it easier to reason about." 147 | msgstr "" 148 | 149 | #: ../../../source/functions.rst:151 150 | msgid "" 151 | "You could also put the ``turtle.forward(100); turtle.right(60)`` portion in " 152 | "the function, but you better not call it ``hexagon`` in that case. That's " 153 | "misleading because it actually draws a hexagon and then advances to a " 154 | "position where another hexagon would make sense in order to draw a " 155 | "honeycomb. If you ever wanted to reuse your hexagon function outside of " 156 | "honeycombs, that would be confusing." 157 | msgstr "" 158 | -------------------------------------------------------------------------------- /source/locale/fr/LC_MESSAGES/functions.po: -------------------------------------------------------------------------------- 1 | # 2 | msgid "" 3 | msgstr "" 4 | "Project-Id-Version: Introduction to Programming with Python 0.1\n" 5 | "Report-Msgid-Bugs-To: \n" 6 | "POT-Creation-Date: 2013-10-25 09:14\n" 7 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 8 | "Last-Translator: FULL NAME \n" 9 | "Language-Team: LANGUAGE \n" 10 | "MIME-Version: 1.0\n" 11 | "Content-Type: text/plain; charset=UTF-8\n" 12 | "Content-Transfer-Encoding: 8bit\n" 13 | 14 | #: ../../../source/functions.rst:2 15 | msgid "User-defined functions" 16 | msgstr "" 17 | 18 | #: ../../../source/functions.rst:5 19 | msgid "Introduction" 20 | msgstr "" 21 | 22 | #: ../../../source/functions.rst:7 23 | msgid "" 24 | "Programmers can deal with some pretty complex and abstract problems, but one" 25 | " sign of a good programmer is that they're lazy. They only like to deal with" 26 | " one thing at a time. So you need a way to break up problems into smaller, " 27 | "discrete pieces, which lets you focus on just the piece you want to." 28 | msgstr "" 29 | 30 | #: ../../../source/functions.rst:12 31 | msgid "" 32 | "Functions are one way to do this abstraction in Python. Let's take " 33 | "``turtle.reset()`` for example. ``reset`` is a function we call on our " 34 | "``turtle``, and it is actually an abstraction for a number of steps, namely:" 35 | msgstr "" 36 | 37 | #: ../../../source/functions.rst:16 38 | msgid "Erase the drawing board." 39 | msgstr "" 40 | 41 | #: ../../../source/functions.rst:17 42 | msgid "Set the width and color back to default." 43 | msgstr "" 44 | 45 | #: ../../../source/functions.rst:18 46 | msgid "Move the turtle back to its initial position." 47 | msgstr "" 48 | 49 | #: ../../../source/functions.rst:20 50 | msgid "" 51 | "But because all the code is contained in the function, we don't have to " 52 | "worry about these details. We can simply *call* this function, and know it " 53 | "will do what it says for us." 54 | msgstr "" 55 | 56 | #: ../../../source/functions.rst:23 57 | msgid "So - how to write your own?" 58 | msgstr "" 59 | 60 | #: ../../../source/functions.rst:25 61 | msgid "A function can be defined with the ``def`` keyword in Python::" 62 | msgstr "" 63 | 64 | #: ../../../source/functions.rst:31 65 | msgid "" 66 | "This function we defined is called ``line_without_moving`` and it is an " 67 | "abstraction for two turtle steps - a move forward and a move backward." 68 | msgstr "" 69 | 70 | #: ../../../source/functions.rst:35 71 | msgid "" 72 | "To use it (or as it is usually called, \"to call it\"), write its name " 73 | "followed by parentheses::" 74 | msgstr "" 75 | 76 | #: ../../../source/functions.rst:46 77 | msgid "We could write more functions to remove some of the repetition::" 78 | msgstr "" 79 | 80 | #: ../../../source/functions.rst:57 81 | msgid "" 82 | "Python uses *indenting with whitespace* to identify blocks of code that " 83 | "belong together. In Python a block (like the function definitions shown " 84 | "above) is introduced with a colon at the end of the line and subsequent " 85 | "commands are indented --- usually 4 spaces further in. The block ends with " 86 | "the first line that isn't indented." 87 | msgstr "" 88 | 89 | #: ../../../source/functions.rst:63 90 | msgid "" 91 | "This is different to many other programming languages, which use special " 92 | "characters (like curly braces ``{}``) to group blocks of code together." 93 | msgstr "" 94 | 95 | #: ../../../source/functions.rst:67 96 | msgid "" 97 | "Never use tab characters to indent your blocks, only spaces. You can -- and " 98 | "should -- configure your editor to put 4 spaces when you press the tab key. " 99 | "The problem with using tab characters is that other python programmers use " 100 | "spaces, and if both are used in the same file python will read it wrong (in " 101 | "the best place, it will complain, and in the worst case, weird, hard to " 102 | "debug bugs will happen)." 103 | msgstr "" 104 | 105 | #: ../../../source/functions.rst:76 106 | msgid "A function for a square" 107 | msgstr "" 108 | 109 | #: ../../../source/functions.rst:79 ../../../source/functions.rst:118 110 | msgid "Exercise" 111 | msgstr "" 112 | 113 | #: ../../../source/functions.rst:81 114 | msgid "" 115 | "Write a function that draws a square. Could you use this function to improve" 116 | " the tilted squares program? If you change the program to use a function, is" 117 | " it easier to experiment with?" 118 | msgstr "" 119 | 120 | #: ../../../source/functions.rst:86 ../../../source/functions.rst:137 121 | msgid "Solution" 122 | msgstr "" 123 | 124 | #: ../../../source/functions.rst:115 125 | msgid "A function for a hexagon" 126 | msgstr "" 127 | 128 | #: ../../../source/functions.rst:120 129 | msgid "Write a function that draws a hexagon." 130 | msgstr "" 131 | 132 | #: ../../../source/functions.rst:124 133 | msgid "" 134 | "Now combine that function into a honeycomb. Just make it with a single layer" 135 | " like this:" 136 | msgstr "" 137 | 138 | #: ../../../source/functions.rst:128 139 | msgid "Give it a good go!" 140 | msgstr "" 141 | 142 | #: ../../../source/functions.rst:132 143 | msgid "" 144 | "Make sure your hexagon function returns your turtle to exactly the same " 145 | "position and angle it was before it was asked to draw the hexagon. This " 146 | "makes it easier to reason about." 147 | msgstr "" 148 | 149 | #: ../../../source/functions.rst:151 150 | msgid "" 151 | "You could also put the ``turtle.forward(100); turtle.right(60)`` portion in " 152 | "the function, but you better not call it ``hexagon`` in that case. That's " 153 | "misleading because it actually draws a hexagon and then advances to a " 154 | "position where another hexagon would make sense in order to draw a " 155 | "honeycomb. If you ever wanted to reuse your hexagon function outside of " 156 | "honeycombs, that would be confusing." 157 | msgstr "" 158 | -------------------------------------------------------------------------------- /source/locale/en/LC_MESSAGES/loops.po: -------------------------------------------------------------------------------- 1 | # 2 | msgid "" 3 | msgstr "" 4 | "Project-Id-Version: Introduction to Programming with Python 0.1\n" 5 | "Report-Msgid-Bugs-To: \n" 6 | "POT-Creation-Date: 2013-10-25 09:37\n" 7 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 8 | "Last-Translator: FULL NAME \n" 9 | "Language-Team: LANGUAGE \n" 10 | "MIME-Version: 1.0\n" 11 | "Content-Type: text/plain; charset=UTF-8\n" 12 | "Content-Transfer-Encoding: 8bit\n" 13 | 14 | #: ../../../source/loops.rst:2 15 | msgid "Loops" 16 | msgstr "" 17 | 18 | #: ../../../source/loops.rst:5 19 | msgid "Introduction" 20 | msgstr "" 21 | 22 | #: ../../../source/loops.rst:7 23 | msgid "" 24 | "Something you might have noticed: our programs often feature repetition. " 25 | "Python has a powerful concept it makes use of called looping (jargon: " 26 | "*iteration*), which we can use to cut out our reptitive code! For now, **try" 27 | " this easy example**::" 28 | msgstr "" 29 | 30 | #: ../../../source/loops.rst:15 31 | msgid "" 32 | "This is incredibly helpful if we want to do something multiple times --- " 33 | "say, drawing the individual border lines of a shape --- but only want to " 34 | "write that action once. Here's another version of a loop::" 35 | msgstr "" 36 | 37 | #: ../../../source/loops.rst:22 38 | msgid "" 39 | "Notice how we write only one line of code using ``i``, but it takes on 10 " 40 | "different values?" 41 | msgstr "" 42 | 43 | #: ../../../source/loops.rst:25 44 | msgid "" 45 | "The :samp:`range(n)` function can be considered a shorthand for ``0, 1, 2, " 46 | "..., n-1``. If you want to know more about it, you can use the help in the " 47 | "Python shell by typing ``help(range)``. Use the :kbd:`q` key to exit the " 48 | "help again." 49 | msgstr "" 50 | 51 | #: ../../../source/loops.rst:30 52 | msgid "You can also loop over elements of your choice::" 53 | msgstr "" 54 | 55 | #: ../../../source/loops.rst:38 56 | msgid "" 57 | "Write this example out and run it with python, to check it works how you " 58 | "might expect." 59 | msgstr "" 60 | 61 | #: ../../../source/loops.rst:43 62 | msgid "" 63 | "Notice how above, the lines of code that are *looped*, are the ones that are" 64 | " *indented*. This is an important concept in Python - that's how it knows " 65 | "which lines should be used in the ``for`` loop, and which come after, as " 66 | "part of the rest of your program. Use four spaces (hitting tab) to indent " 67 | "your code." 68 | msgstr "" 69 | 70 | #: ../../../source/loops.rst:49 71 | msgid "" 72 | "Sometimes you want to repeat some code a number of times, but don't care " 73 | "about the value of the ``i`` variable; so it can be good practice to replace" 74 | " it with ``_`` instead. This signifies that we don't care about its value, " 75 | "or don't wish to use it. Here's a simple example::" 76 | msgstr "" 77 | 78 | #: ../../../source/loops.rst:57 79 | msgid "" 80 | "You may or may not be wondering about the variable ``i`` - why is it used " 81 | "all the time above? Well, it simply stands for \"index\" and is one of the " 82 | "most common variable names ever found in code. But if you are looping over " 83 | "something other than just numbers, be sure to name it something better! For " 84 | "instance::" 85 | msgstr "" 86 | 87 | #: ../../../source/loops.rst:65 88 | msgid "" 89 | "This is immediately clearer to understand than if we had used ``i`` instead " 90 | "of ``drink``." 91 | msgstr "" 92 | 93 | #: ../../../source/loops.rst:69 94 | msgid "Drawing a dashed line" 95 | msgstr "" 96 | 97 | #: ../../../source/loops.rst:72 ../../../source/loops.rst:126 98 | msgid "Exercise" 99 | msgstr "" 100 | 101 | #: ../../../source/loops.rst:74 102 | msgid "" 103 | "Draw a dashed line. You can move the turtle without the turtle drawing its " 104 | "movement by using the ``turtle.penup()`` function; to tell it to draw again," 105 | " use ``turtle.pendown()``." 106 | msgstr "" 107 | 108 | #: ../../../source/loops.rst:81 ../../../source/loops.rst:133 109 | msgid "Solution" 110 | msgstr "" 111 | 112 | #: ../../../source/loops.rst:92 ../../../source/loops.rst:142 113 | msgid "Bonus" 114 | msgstr "" 115 | 116 | #: ../../../source/loops.rst:94 117 | msgid "Can you make the dashes become larger as the line progresses?" 118 | msgstr "" 119 | 120 | #: ../../../source/loops.rst:100 121 | msgid "Feeling lost? Inspect ``i`` at every run of the loop::" 122 | msgstr "" 123 | 124 | #: ../../../source/loops.rst:106 125 | msgid "" 126 | "Can you utilize ``i`` --- commonly called the **index** variable or loop " 127 | "variable --- to get increasing step sizes?" 128 | msgstr "" 129 | 130 | #: ../../../source/loops.rst:110 131 | msgid "Comments" 132 | msgstr "" 133 | 134 | #: ../../../source/loops.rst:112 135 | msgid "" 136 | "In the example above, the line that starts with a ``#`` is called a comment." 137 | " In Python, anything that goes on a line after ``#`` is ignored by the " 138 | "computer. Use comments to explain what your program does, without changing " 139 | "the behaviour for the computer. They can also be used to easily and " 140 | "temporarily disable, or \"comment out\" some lines of code." 141 | msgstr "" 142 | 143 | #: ../../../source/loops.rst:118 144 | msgid "Comments can also go at the end of a line, like this::" 145 | msgstr "" 146 | 147 | #: ../../../source/loops.rst:123 148 | msgid "More Efficient Squares" 149 | msgstr "" 150 | 151 | #: ../../../source/loops.rst:128 152 | msgid "" 153 | "The squares we were drawing at the start of this tutorial had a lot of " 154 | "repeated lines of code. Can you write out a square drawing program in fewer " 155 | "lines by utilizing loops?" 156 | msgstr "" 157 | 158 | #: ../../../source/loops.rst:144 159 | msgid "" 160 | "Try *nesting* loops, by putting one right under (*inside*) the other, with " 161 | "some drawing code that's inside both. Here's what it can look like::" 162 | msgstr "" 163 | 164 | #: ../../../source/loops.rst:155 165 | msgid "" 166 | "Replace the ``...``'s with your own code, and see if you can come up with " 167 | "something funny or interesting! :sup:`Mistakes are encouraged!`" 168 | msgstr "" 169 | -------------------------------------------------------------------------------- /source/locale/fr/LC_MESSAGES/loops.po: -------------------------------------------------------------------------------- 1 | # 2 | msgid "" 3 | msgstr "" 4 | "Project-Id-Version: Introduction to Programming with Python 0.1\n" 5 | "Report-Msgid-Bugs-To: \n" 6 | "POT-Creation-Date: 2013-10-25 09:14\n" 7 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 8 | "Last-Translator: FULL NAME \n" 9 | "Language-Team: LANGUAGE \n" 10 | "MIME-Version: 1.0\n" 11 | "Content-Type: text/plain; charset=UTF-8\n" 12 | "Content-Transfer-Encoding: 8bit\n" 13 | 14 | #: ../../../source/loops.rst:2 15 | msgid "Loops" 16 | msgstr "" 17 | 18 | #: ../../../source/loops.rst:5 19 | msgid "Introduction" 20 | msgstr "" 21 | 22 | #: ../../../source/loops.rst:7 23 | msgid "" 24 | "Something you might have noticed: our programs often feature repetition. " 25 | "Python has a powerful concept it makes use of called looping (jargon: " 26 | "*iteration*), which we can use to cut out our reptitive code! For now, **try" 27 | " this easy example**::" 28 | msgstr "" 29 | 30 | #: ../../../source/loops.rst:15 31 | msgid "" 32 | "This is incredibly helpful if we want to do something multiple times --- " 33 | "say, drawing the individual border lines of a shape --- but only want to " 34 | "write that action once. Here's another version of a loop::" 35 | msgstr "" 36 | 37 | #: ../../../source/loops.rst:22 38 | msgid "" 39 | "Notice how we write only one line of code using ``i``, but it takes on 10 " 40 | "different values?" 41 | msgstr "" 42 | 43 | #: ../../../source/loops.rst:25 44 | msgid "" 45 | "The :samp:`range(n)` function can be considered a shorthand for ``0, 1, 2, " 46 | "..., n-1``. If you want to know more about it, you can use the help in the " 47 | "Python shell by typing ``help(range)``. Use the :kbd:`q` key to exit the " 48 | "help again." 49 | msgstr "" 50 | 51 | #: ../../../source/loops.rst:30 52 | msgid "You can also loop over elements of your choice::" 53 | msgstr "" 54 | 55 | #: ../../../source/loops.rst:38 56 | msgid "" 57 | "Write this example out and run it with python, to check it works how you " 58 | "might expect." 59 | msgstr "" 60 | 61 | #: ../../../source/loops.rst:43 62 | msgid "" 63 | "Notice how above, the lines of code that are *looped*, are the ones that are" 64 | " *indented*. This is an important concept in Python - that's how it knows " 65 | "which lines should be used in the ``for`` loop, and which come after, as " 66 | "part of the rest of your program. Use four spaces (hitting tab) to indent " 67 | "your code." 68 | msgstr "" 69 | 70 | #: ../../../source/loops.rst:49 71 | msgid "" 72 | "Sometimes you want to repeat some code a number of times, but don't care " 73 | "about the value of the ``i`` variable; so it can be good practice to replace" 74 | " it with ``_`` instead. This signifies that we don't care about its value, " 75 | "or don't wish to use it. Here's a simple example::" 76 | msgstr "" 77 | 78 | #: ../../../source/loops.rst:57 79 | msgid "" 80 | "You may or may not be wondering about the variable ``i`` - why is it used " 81 | "all the time above? Well, it simply stands for \"index\" and is one of the " 82 | "most common variable names ever found in code. But if you are looping over " 83 | "something other than just numbers, be sure to name it something better! For " 84 | "instance::" 85 | msgstr "" 86 | 87 | #: ../../../source/loops.rst:65 88 | msgid "" 89 | "This is immediately clearer to understand than if we had used ``i`` instead " 90 | "of ``drink``." 91 | msgstr "" 92 | 93 | #: ../../../source/loops.rst:69 94 | msgid "Drawing a dashed line" 95 | msgstr "" 96 | 97 | #: ../../../source/loops.rst:72 ../../../source/loops.rst:126 98 | msgid "Exercise" 99 | msgstr "" 100 | 101 | #: ../../../source/loops.rst:74 102 | msgid "" 103 | "Draw a dashed line. You can move the turtle without the turtle drawing its " 104 | "movement by using the ``turtle.penup()`` function; to tell it to draw again," 105 | " use ``turtle.pendown()``." 106 | msgstr "" 107 | 108 | #: ../../../source/loops.rst:81 ../../../source/loops.rst:133 109 | msgid "Solution" 110 | msgstr "" 111 | 112 | #: ../../../source/loops.rst:92 ../../../source/loops.rst:142 113 | msgid "Bonus" 114 | msgstr "" 115 | 116 | #: ../../../source/loops.rst:94 117 | msgid "Can you make the dashes become larger as the line progresses?" 118 | msgstr "" 119 | 120 | #: ../../../source/loops.rst:100 121 | msgid "Feeling lost? Inspect ``i`` at every run of the loop::" 122 | msgstr "" 123 | 124 | #: ../../../source/loops.rst:106 125 | msgid "" 126 | "Can you utilize ``i`` --- commonly called the **index** variable or loop " 127 | "variable --- to get increasing step sizes?" 128 | msgstr "" 129 | 130 | #: ../../../source/loops.rst:110 131 | msgid "Comments" 132 | msgstr "" 133 | 134 | #: ../../../source/loops.rst:112 135 | msgid "" 136 | "In the example above, the line that starts with a ``#`` is called a comment." 137 | " In Python, anything that goes on a line after ``#`` is ignored by the " 138 | "computer. Use comments to explain what your program does, without changing " 139 | "the behaviour for the computer. They can also be used to easily and " 140 | "temporarily disable, or \"comment out\" some lines of code." 141 | msgstr "" 142 | 143 | #: ../../../source/loops.rst:118 144 | msgid "Comments can also go at the end of a line, like this::" 145 | msgstr "" 146 | 147 | #: ../../../source/loops.rst:123 148 | msgid "More Efficient Squares" 149 | msgstr "" 150 | 151 | #: ../../../source/loops.rst:128 152 | msgid "" 153 | "The squares we were drawing at the start of this tutorial had a lot of " 154 | "repeated lines of code. Can you write out a square drawing program in fewer " 155 | "lines by utilizing loops?" 156 | msgstr "" 157 | 158 | #: ../../../source/loops.rst:144 159 | msgid "" 160 | "Try *nesting* loops, by putting one right under (*inside*) the other, with " 161 | "some drawing code that's inside both. Here's what it can look like::" 162 | msgstr "" 163 | 164 | #: ../../../source/loops.rst:155 165 | msgid "" 166 | "Replace the ``...``'s with your own code, and see if you can come up with " 167 | "something funny or interesting! :sup:`Mistakes are encouraged!`" 168 | msgstr "" 169 | -------------------------------------------------------------------------------- /source/locale/ro/LC_MESSAGES/variables.po: -------------------------------------------------------------------------------- 1 | # SOME DESCRIPTIVE TITLE. 2 | # Copyright (C) 2012–2014, OpenTechSchool and contributors 3 | # This file is distributed under the same license as the Introduction to Programming with Python package. 4 | # 5 | # Translators: 6 | # Razvan Stefanescu , 2015 7 | msgid "" 8 | msgstr "" 9 | "Project-Id-Version: Python for beginners\n" 10 | "Report-Msgid-Bugs-To: \n" 11 | "POT-Creation-Date: 2015-10-02 06:32+1000\n" 12 | "PO-Revision-Date: 2015-04-01 10:50+0000\n" 13 | "Last-Translator: Razvan Stefanescu \n" 14 | "Language-Team: Romanian (http://www.transifex.com/opentechschool/python-for-beginners/language/ro/)\n" 15 | "MIME-Version: 1.0\n" 16 | "Content-Type: text/plain; charset=UTF-8\n" 17 | "Content-Transfer-Encoding: 8bit\n" 18 | "Language: ro\n" 19 | "Plural-Forms: nplurals=3; plural=(n==1?0:(((n%100>19)||((n%100==0)&&(n!=0)))?2:1));\n" 20 | 21 | #: ../../../source/variables.rst:2 22 | msgid "Variables" 23 | msgstr "Variabile" 24 | 25 | #: ../../../source/variables.rst:5 26 | msgid "Introduction" 27 | msgstr "Introducere" 28 | 29 | #: ../../../source/variables.rst:7 30 | msgid "" 31 | "Whew. Experimenting with the angles requires you to change three different " 32 | "places in the code each time. Imagine you'd want to experiment with all of " 33 | "the square sizes, let alone with rectangles! We can do better than that." 34 | msgstr "Ptiu! Experimentarea cu aceste unghiuri îți cere să schimbi trei locuri diferite din cod de fiecare dată. Imaginează-ți că ai dori să expermentezi cu toate dimensiunile pătratelor, nu mai zic de dreptunghiuri! Asta se poate îmbunătăți." 35 | 36 | #: ../../../source/variables.rst:11 37 | msgid "" 38 | "This is where **variables** come into play: You can tell Python that from " 39 | "now on, whenever you refer to a variable, you actually mean something else. " 40 | "That concept might be familiar from symbolic maths, where you would write: " 41 | "*Let x be 5.* Then *x \\* 2* will obviously be *10*." 42 | msgstr "Și aici intră în scenă **variabilele**: poți să îi spui lui Python că din acest moment, de fiecare dată cănd faci referire la o variabilă, vrei de fapt să spui altceva. Conceptul acesta ar putea fi familiar de la simbolurile matematice, unde scrii *Fie x = 5*. Atunci *x \\* 2* va fi evident *10*." 43 | 44 | #: ../../../source/variables.rst:16 45 | msgid "In Python syntax, that very statement translates to::" 46 | msgstr "În sintaxa Python, exact același lucru se scrie:" 47 | 48 | #: ../../../source/variables.rst:20 49 | msgid "" 50 | "After that statement, if you do ``print(x)``, it will actually output its " 51 | "value --- 5. Well, can use that for your turtle too::" 52 | msgstr "După această declarație, dacă dai comanda ``print(x)``, va tipări de fapt valoarea --- 5. Ei bine, putem utiliza asta și pentru țestoasă:" 53 | 54 | #: ../../../source/variables.rst:25 55 | msgid "" 56 | "Variables can store all sorts of things, not just numbers. A typical other " 57 | "thing you want to have stored often is a **string** - a line of text. " 58 | "Strings are indicated with a starting and a leading ``\"`` (double quote). " 59 | "You'll learn about this and other types, as those are called in Python, and " 60 | "what you can do with them later on." 61 | msgstr "Variabilele pot păstra tot felul de lucruri, nu numai numere. Un alt lucru pe care dorești de regulă să îl păstrezi sunt **șiruri de caractere** - o linie de text. Șirurile sunt indicate cu ``\"`` (ghilimele) la început și la sfârșit. Vom învăța în continuare despre ele și despre alte tipuri, cum sunt ele denumite în Python, și ce poți face cu ele." 62 | 63 | #: ../../../source/variables.rst:31 64 | msgid "You can even use a variable to give the turtle a name::" 65 | msgstr "Poți utiliza o variabilă pentru a da un nume țestoasei:" 66 | 67 | #: ../../../source/variables.rst:35 68 | msgid "" 69 | "Now every time you type ``timmy`` it knows you mean ``turtle``. You can " 70 | "still continue to use ``turtle`` as well::" 71 | msgstr "Acum de fiecare dată când scrii ``timmy`` va ști că vorbești despre ``turtle``. Poți să folosești în continuare și ``turtle``:" 72 | 73 | #: ../../../source/variables.rst:43 74 | msgid "A variable called angle" 75 | msgstr "O variabilă numită angle (unghi)" 76 | 77 | #: ../../../source/variables.rst:46 ../../../source/variables.rst:85 78 | msgid "Exercise" 79 | msgstr "Exercițiu" 80 | 81 | #: ../../../source/variables.rst:48 82 | msgid "" 83 | "If we have a variable called ``angle``, how could we use that to experiment " 84 | "much faster with our tilted squares program?" 85 | msgstr "Dacă avem o variabilă numită ``angle`` (unghi), cum o putem utiliza pentru a experimenta mai rapid cu programul nostru de pătrate înclinate?" 86 | 87 | #: ../../../source/variables.rst:54 88 | msgid "Solution" 89 | msgstr "Soluția" 90 | 91 | #: ../../../source/variables.rst:74 92 | msgid "... and so on" 93 | msgstr "... și așa mai departe" 94 | 95 | #: ../../../source/variables.rst:77 96 | msgid "Bonus" 97 | msgstr "Supliment" 98 | 99 | #: ../../../source/variables.rst:79 100 | msgid "Can you apply that principle to the size of the squares, too?" 101 | msgstr "Poți aplica acest principiu și la dimensiunea pătratelor?" 102 | 103 | #: ../../../source/variables.rst:82 104 | msgid "The house of santa claus" 105 | msgstr "Casa lui Moș Crăciun" 106 | 107 | #: ../../../source/variables.rst:87 108 | msgid "Draw a house." 109 | msgstr "Desenează o casă." 110 | 111 | #: ../../../source/variables.rst:91 112 | msgid "" 113 | "You can calculate the length of the diagonal line with the Pythagorean " 114 | "theorem. That value is a good candidate to store in a variable. To calculate" 115 | " the square root of a number in Python, you'll need to import the *math* " 116 | "module and use the ``math.sqrt()`` function. The square of a number is " 117 | "calculated with the ``**`` operator::" 118 | msgstr "Poți calcula lungimea diagonalei folosind teorema lui Pitagora. Această valoare este un bun candidat pentru a fi stocată într-o variabilă. Pentru a calcula rădăcina pătrată a unui număr în Python, va fi nevoie să imporți modulul *math* și să folosești funcția ``math.sqrt()``. Pătratul unui număr este calculat cu operatorul ``**``:" 119 | -------------------------------------------------------------------------------- /source/locale/ru/LC_MESSAGES/variables.po: -------------------------------------------------------------------------------- 1 | # SOME DESCRIPTIVE TITLE. 2 | # Copyright (C) 2012–2014, OpenTechSchool and contributors 3 | # This file is distributed under the same license as the Introduction to Programming with Python package. 4 | # 5 | # Translators: 6 | # sorrymak , 2013 7 | msgid "" 8 | msgstr "" 9 | "Project-Id-Version: Python for beginners\n" 10 | "Report-Msgid-Bugs-To: \n" 11 | "POT-Creation-Date: 2014-06-09 11:00+1000\n" 12 | "PO-Revision-Date: 2013-12-16 14:59+0000\n" 13 | "Last-Translator: sorrymak \n" 14 | "Language-Team: Russian (http://www.transifex.com/projects/p/python-for-beginners/language/ru/)\n" 15 | "MIME-Version: 1.0\n" 16 | "Content-Type: text/plain; charset=UTF-8\n" 17 | "Content-Transfer-Encoding: 8bit\n" 18 | "Language: ru\n" 19 | "Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" 20 | 21 | # 016333f418f04abb99e1f153b93d1733 22 | #: ../../../source/variables.rst:2 23 | msgid "Variables" 24 | msgstr "Переменные" 25 | 26 | # 2a00a8448498495ba72c8e5c1b7be5a3 27 | #: ../../../source/variables.rst:5 28 | msgid "Introduction" 29 | msgstr "Введение" 30 | 31 | # 11e299324f7f446fb7fc1fe39af9ea9f 32 | #: ../../../source/variables.rst:7 33 | msgid "" 34 | "Whew. Experimenting with the angles requires you to change three different " 35 | "places in the code each time. Imagine you'd want to experiment with all of " 36 | "the square sizes, let alone with rectangles! We can do better than that." 37 | msgstr "Хорошо. Экспериментируя в прошлом уроке, нам приходилось редактировать код в нескольких местах, чтобы изменить размеры наших геометрических фигур. Но представь, что будет, если мы захотим изменить размер квадрата не один раз, не говоря уже о прямоугольниках! Есть способ получше." 38 | 39 | # a2712e5a1bf24c91bf73db77f5094695 40 | #: ../../../source/variables.rst:11 41 | msgid "" 42 | "This is where **variables** come into play: You can tell Python that from " 43 | "now on, whenever you refer to a variable, you actually mean something else. " 44 | "That concept might be familiar from symbolic maths, where you would write: " 45 | "*Let x be 5.* Then *x \\* 2* will obviously be *10*." 46 | msgstr "Это **переменные**. Можно сообщить Python'у, что отныне при обращении к переменной имеется в виду что-то другое. Это похоже на символическую математику, где можно написать: *Пусть x равняется 5.* Тогда. очевидно, *x \\* 2* будет равняться 10." 47 | 48 | # fa0a962bd37d4e8eb7ba0ee69b28e8ee 49 | #: ../../../source/variables.rst:16 50 | msgid "In Python syntax, that very statement translates to::" 51 | msgstr "С помощью Python'а сиё можно записать так::" 52 | 53 | # 986235ce1d8b44ebb5dd81ce1b1abd75 54 | #: ../../../source/variables.rst:20 55 | msgid "" 56 | "After that statement, if you do ``print(x)``, it will actually output its " 57 | "value --- 5. Well, can use that for your turtle too::" 58 | msgstr "После этого, если ты выполнишь ``print(x)``, будет выведено значение переменной --- 5. x можно задействовать и в обращении к черепашке::" 59 | 60 | # 41ee9fc89f5b45a8b560e9c5ddf7b512 61 | #: ../../../source/variables.rst:25 62 | msgid "" 63 | "Variables can store all sorts of things, not just numbers. A typical other " 64 | "thing you want to have stored often is a **string** - a line of text. " 65 | "Strings are indicated with a starting and a leading ``\"`` (double quote). " 66 | "You'll learn about this and other types, as those are called in Python, and " 67 | "what you can do with them later on." 68 | msgstr "Переменные могут быть чем угодно, не только числами. Типичной вещью, хранящейся в переменной, является **строка** - строка текста. Строки можно распознать по двойным кавычкам, с которых они начинаются и которыми они заканчиваются. Позже ты узнаешь больше об этом и других типах данных, их применении, и о том, как они называются в Python." 69 | 70 | # 6023dfa68c764ea991ca7a7912e7bceb 71 | #: ../../../source/variables.rst:31 72 | msgid "You can even use a variable to give the turtle a name::" 73 | msgstr "Ты можешь использовать переменную даже для того, чтобы дать черепашке имя::" 74 | 75 | # 6c986c3906d34cd2a73d98485fa4d3e0 76 | #: ../../../source/variables.rst:35 77 | msgid "" 78 | "Now every time you type ``timmy`` it knows you mean ``turtle``. You can " 79 | "still continue to use ``turtle`` as well::" 80 | msgstr "Теперь, когда ты вводишь ``timmy``, это будет означать ``turtle``. Но ты всё ещё можешь продолжать использовать и непосредственно ``turtle``::" 81 | 82 | # 855b759cf6614117812596f0572da969 83 | #: ../../../source/variables.rst:43 84 | msgid "A variable called angle" 85 | msgstr "Переменная, зовущаяся углом" 86 | 87 | # 341a0b4eab9c4060983a009910f9912b 88 | # c7f79c6a0e3f438c8cbddaeac9e3b967 89 | #: ../../../source/variables.rst:46 ../../../source/variables.rst:85 90 | msgid "Exercise" 91 | msgstr "Упражнение" 92 | 93 | # 98036cab6adc4843be4121ad8a525a46 94 | #: ../../../source/variables.rst:48 95 | msgid "" 96 | "If we have a variable called ``angle``, how could we use that to experiment " 97 | "much faster with our tilted squares program?" 98 | msgstr "Как мы можем ускорить работу с нашей программой для рисования накренившихся квадратов, имея переменную ``angle``?" 99 | 100 | # 4f5e8724e9bf47bb9a308c96b099e1bd 101 | #: ../../../source/variables.rst:54 102 | msgid "Solution" 103 | msgstr "Решение" 104 | 105 | # e5cc56f2272342e2a9817063d345d126 106 | #: ../../../source/variables.rst:74 107 | msgid "... and so on" 108 | msgstr "... и так далее." 109 | 110 | # f88b19f8666e4f3699d3fa8a1d16eeeb 111 | #: ../../../source/variables.rst:77 112 | msgid "Bonus" 113 | msgstr "Дополнительно" 114 | 115 | # 1af525ffffc44dba842bbaac6875a109 116 | #: ../../../source/variables.rst:79 117 | msgid "Can you apply that principle to the size of the squares, too?" 118 | msgstr "Можешь ли ты проделать то же самое с размером квадрата?" 119 | 120 | # 860b1520bc564aae8f16cbeaf5723c13 121 | #: ../../../source/variables.rst:82 122 | msgid "The house of santa claus" 123 | msgstr "Домик Деда Мороза" 124 | 125 | # 1d280501f67a473aad5e0d4531953a0d 126 | #: ../../../source/variables.rst:87 127 | msgid "Draw a house." 128 | msgstr "Нарисуй домик." 129 | 130 | # cf4fc858e79b449fbfe315cf438b5e39 131 | #: ../../../source/variables.rst:91 132 | msgid "" 133 | "You can calculate the length of the diagonal line with the Pythagorean " 134 | "theorem. That value is a good candidate to store in a variable. To calculate" 135 | " the square root of a number in Python, you'll need to import the *math* " 136 | "module and use the ``math.sqrt()`` function. The square of a number is " 137 | "calculated with the ``**`` operator::" 138 | msgstr "" 139 | -------------------------------------------------------------------------------- /source/locale/ko/LC_MESSAGES/where_to_go.po: -------------------------------------------------------------------------------- 1 | # SOME DESCRIPTIVE TITLE. 2 | # Copyright (C) 2012–2014, OpenTechSchool and contributors 3 | # This file is distributed under the same license as the Introduction to Programming with Python package. 4 | # 5 | # Translators: 6 | # Seong-ho Cho , 2014 7 | msgid "" 8 | msgstr "" 9 | "Project-Id-Version: Python for beginners\n" 10 | "Report-Msgid-Bugs-To: \n" 11 | "POT-Creation-Date: 2014-06-09 11:00+1000\n" 12 | "PO-Revision-Date: 2014-02-22 21:09+0000\n" 13 | "Last-Translator: Seong-ho Cho \n" 14 | "Language-Team: Korean (http://www.transifex.com/projects/p/python-for-beginners/language/ko/)\n" 15 | "MIME-Version: 1.0\n" 16 | "Content-Type: text/plain; charset=UTF-8\n" 17 | "Content-Transfer-Encoding: 8bit\n" 18 | "Language: ko\n" 19 | "Plural-Forms: nplurals=1; plural=0;\n" 20 | 21 | # 4ca9d9a1ac994da2b6d3f04a90aa29ed 22 | #: ../../../source/where_to_go.rst:2 23 | msgid "Where to go from here" 24 | msgstr "어디로 가야 하나요?" 25 | 26 | # 9fe9c5c26d3b4aff8c0025ce35c0c998 27 | #: ../../../source/where_to_go.rst:5 28 | msgid "Learning Python" 29 | msgstr "파이선 배우기" 30 | 31 | # f5b53819b24749528d73d4a44c249b2a 32 | #: ../../../source/where_to_go.rst:7 33 | msgid "" 34 | "Hopefully this tutorial has tought you just enough python to get you on your" 35 | " feet. However, there is much more that you can learn! Even professional " 36 | "programmers will always be trying to learn more about their language and how" 37 | " to code excellently with it." 38 | msgstr "이 따라하기 참고서가 여러분이 파이선에 한발짝 걸어가는데 충분히 가르쳤으면 좋겠어요. 하지만 배울 수 있는건 참 많아요! 전문 프로그래머도 자신들 언어에 대해, 어떻게 코드를 해당 언어로 멋지게 짤지 항상 더 배우려고 해요." 39 | 40 | # 429ea1e64b97494ba2f233b78a084eab 41 | #: ../../../source/where_to_go.rst:14 42 | msgid "Books and Tutorials" 43 | msgstr "책과 따라하기 참고서" 44 | 45 | # aee14e13261a4a7cab9d87566b02a183 46 | #: ../../../source/where_to_go.rst:16 47 | msgid "" 48 | "If you like learning from a book, there are heaps of good ones, and even " 49 | "many that can be read freely on the web!" 50 | msgstr "" 51 | 52 | # e7ff8f8afc3f45ca963bb235a00623d9 53 | #: ../../../source/where_to_go.rst:19 54 | msgid "" 55 | "`OTS Python Portal`_ - Check the rest of our tutorials, and look out for " 56 | "future workshops!" 57 | msgstr "" 58 | 59 | # e8e7cd87fb9c4d3bb788d0bad28268c4 60 | #: ../../../source/where_to_go.rst:21 61 | msgid "" 62 | "`O'Reilly`_ publishes hundreds of books and ebooks, on python and many other" 63 | " technologies (check out Learning Python, 5th edition)." 64 | msgstr "" 65 | 66 | # 676d7d6e75e64d0b81cf0e800516ba6c 67 | #: ../../../source/where_to_go.rst:23 68 | msgid "" 69 | "`Invent with Python`_ takes a practical approach, with three different " 70 | "ebooks that can be read online for free." 71 | msgstr "" 72 | 73 | # d1f0977e6f8b40f08959767ba080178a 74 | #: ../../../source/where_to_go.rst:25 75 | msgid "" 76 | "`Learn Python the Hard Way`_ is a step by step full tutorial on the " 77 | "language, done in a unique style." 78 | msgstr "" 79 | 80 | # c1a2eb187d5944d69f19b679be2f1c66 81 | #: ../../../source/where_to_go.rst:27 82 | msgid "`Dive into Python 3`_ is another great book available online for free!" 83 | msgstr "" 84 | 85 | # 31a6946cd7184e00a10c9018d7f3974b 86 | #: ../../../source/where_to_go.rst:28 87 | msgid "Last but not least, python.org has `Its own tutorial!`_" 88 | msgstr "마지막이긴 한데 최소한 python.org에 `자체 따라하기 참고서`_가 있어요!" 89 | 90 | # f115eb306df240a68642600624bfac16 91 | #: ../../../source/where_to_go.rst:40 92 | msgid "Online learning courses" 93 | msgstr "온라인 학습 과정" 94 | 95 | # d7f3fa342eb8423a9351bdbc5537442e 96 | #: ../../../source/where_to_go.rst:42 97 | msgid "" 98 | "You wouldn't believe what you can do on the web these days. There are many " 99 | "courses on programming around!" 100 | msgstr "요해 웹에서 이런걸 할 수 있다는걸 믿지 못하셨을거예요. 프로그래밍 과정이 주변에 많이 있어요!" 101 | 102 | # d3621573971e441799e8283b77a0c730 103 | #: ../../../source/where_to_go.rst:45 104 | msgid "" 105 | "`Edx`_ - with top universities like Stanford, MIT, Harvard and Berkley " 106 | "giving out interactive courses for free, it's hard to turn this down. You'll" 107 | " have to look for ones coming up soon!" 108 | msgstr "" 109 | 110 | # 19ac5da1918c421a804f482f57575cd0 111 | #: ../../../source/where_to_go.rst:48 112 | msgid "" 113 | "`Coursera`_ is very similar to Edx, with even more courses, and some that " 114 | "can be taken at any time." 115 | msgstr "" 116 | 117 | # c92961467e72449892428cd6257cd00a 118 | #: ../../../source/where_to_go.rst:50 119 | msgid "" 120 | "`CodeAcademy`_ - luckily this one has a python-specific course that can be " 121 | "taken at any time, and many other practical language courses." 122 | msgstr "" 123 | 124 | # 13fc3df0f1d54332a62d4170c2329568 125 | #: ../../../source/where_to_go.rst:62 126 | msgid "What to do with Python" 127 | msgstr "파이선으로 뭘 해야 하나요" 128 | 129 | # 3a304b4e117b4b63bf50d38dbe379a22 130 | #: ../../../source/where_to_go.rst:64 131 | msgid "" 132 | "Well, that's a tough one! See, practically anything you can think of " 133 | "involving some electronics - from your TV remote, to a smartphone, to the " 134 | "backend of a popular web service, to the scheduling of airport landings, to " 135 | "the software you use everyday - it all involves some programming somewhere!" 136 | msgstr "" 137 | 138 | # e1c877ce99654871b4b2c0a00d9c1da1 139 | #: ../../../source/where_to_go.rst:69 140 | msgid "" 141 | "And not only is it a big field practically, but also technically and " 142 | "academically. As soon as you have a basic understanding of a general " 143 | "language like python, you can start working on all manner of subjects: web " 144 | "frontends, web backend services, data analysis and statistics, Artificial " 145 | "Intelligence, GUI design, robotics, software development of all kinds, " 146 | "online transactions, automation of everything, and many more." 147 | msgstr "" 148 | 149 | # 4605be188ec54a6198c8ad739f2ae1cf 150 | #: ../../../source/where_to_go.rst:76 151 | msgid "" 152 | "We wouldn't blame if that all sounds daunting, so here's some practical " 153 | "advice, that takes advantage of how wide a field \"programming\" is:" 154 | msgstr "" 155 | 156 | # 2e5a395697c84fcb9361940d3885cff6 157 | #: ../../../source/where_to_go.rst:79 158 | msgid "**Apply your new skills to whatever you're passionate about.**" 159 | msgstr "" 160 | 161 | # 3a9e1b0234e74693bf86e1416f3a70fc 162 | #: ../../../source/where_to_go.rst:81 163 | msgid "" 164 | "Whether that's starting a new business, helping you do some task involving " 165 | "data faster, putting up an online site, calculating advantages in a game you" 166 | " play, creating art and music, or anything else, finding out how to use " 167 | "programming to help with whatever floats your boat will make learning much " 168 | "more exciting and relevant. Feel free to ask someone more experienced if you" 169 | " have no idea where to start, but always mention what makes you tick!" 170 | msgstr "" 171 | -------------------------------------------------------------------------------- /source/locale/es_CL/LC_MESSAGES/variables.po: -------------------------------------------------------------------------------- 1 | # SOME DESCRIPTIVE TITLE. 2 | # Copyright (C) 2012–2014, OpenTechSchool and contributors 3 | # This file is distributed under the same license as the Introduction to Programming with Python package. 4 | # 5 | # Translators: 6 | # Patricio Alejandro Urrutia Arestizábal , 2013 7 | msgid "" 8 | msgstr "" 9 | "Project-Id-Version: Python for beginners\n" 10 | "Report-Msgid-Bugs-To: \n" 11 | "POT-Creation-Date: 2014-06-09 11:00+1000\n" 12 | "PO-Revision-Date: 2013-11-13 14:11+0000\n" 13 | "Last-Translator: Patricio Alejandro Urrutia Arestizábal \n" 14 | "Language-Team: Spanish (Chile) (http://www.transifex.com/projects/p/python-for-beginners/language/es_CL/)\n" 15 | "MIME-Version: 1.0\n" 16 | "Content-Type: text/plain; charset=UTF-8\n" 17 | "Content-Transfer-Encoding: 8bit\n" 18 | "Language: es_CL\n" 19 | "Plural-Forms: nplurals=2; plural=(n != 1);\n" 20 | 21 | # 016333f418f04abb99e1f153b93d1733 22 | #: ../../../source/variables.rst:2 23 | msgid "Variables" 24 | msgstr "Variables" 25 | 26 | # 2a00a8448498495ba72c8e5c1b7be5a3 27 | #: ../../../source/variables.rst:5 28 | msgid "Introduction" 29 | msgstr "Introducción" 30 | 31 | # 11e299324f7f446fb7fc1fe39af9ea9f 32 | #: ../../../source/variables.rst:7 33 | msgid "" 34 | "Whew. Experimenting with the angles requires you to change three different " 35 | "places in the code each time. Imagine you'd want to experiment with all of " 36 | "the square sizes, let alone with rectangles! We can do better than that." 37 | msgstr "Uf! Experimentando con ángulos requiere que cambie tres partes distintas en el código cada vez. Imagine que quiera experimentar con todos los tamaños de cuadrados, ni hablar con rectángulos! Podemos hacer algo mejor que eso." 38 | 39 | # a2712e5a1bf24c91bf73db77f5094695 40 | #: ../../../source/variables.rst:11 41 | msgid "" 42 | "This is where **variables** come into play: You can tell Python that from " 43 | "now on, whenever you refer to a variable, you actually mean something else. " 44 | "That concept might be familiar from symbolic maths, where you would write: " 45 | "*Let x be 5.* Then *x \\* 2* will obviously be *10*." 46 | msgstr "Es aquí donde las **variables** entran en juego. Puede decirle a Python que, de ahora en adelante, cada vez que se refiera a una variable, usted se refiere en realidad a otra cosa. Este concepto puede ser familiar de matemáticas simbólicas, donde usted puede escribir: *Sea x igual a 5*. Entonces *x \\* 2* será obviamente *10*." 47 | 48 | # fa0a962bd37d4e8eb7ba0ee69b28e8ee 49 | #: ../../../source/variables.rst:16 50 | msgid "In Python syntax, that very statement translates to::" 51 | msgstr "En sintaxis de Python, esa misma sentencia se traduce como::" 52 | 53 | # 986235ce1d8b44ebb5dd81ce1b1abd75 54 | #: ../../../source/variables.rst:20 55 | msgid "" 56 | "After that statement, if you do ``print(x)``, it will actually output its " 57 | "value --- 5. Well, can use that for your turtle too::" 58 | msgstr "Despues de esa sentencia, si usted ejecuta ``print(x)``, realmente imprimirá su valor --- 5. Bien, puede usar eso para su tortuga también::" 59 | 60 | # 41ee9fc89f5b45a8b560e9c5ddf7b512 61 | #: ../../../source/variables.rst:25 62 | msgid "" 63 | "Variables can store all sorts of things, not just numbers. A typical other " 64 | "thing you want to have stored often is a **string** - a line of text. " 65 | "Strings are indicated with a starting and a leading ``\"`` (double quote). " 66 | "You'll learn about this and other types, as those are called in Python, and " 67 | "what you can do with them later on." 68 | msgstr "Variables pueden almacenar todo tipo de cosas, no sólo números. Otra cosa típica que a menudo es almacenada es un **string** - una línea de texto. Strings se indican con ``\"``(comillas dobles) al inicio y al final. Aprenderá sobre este y otros tipos de variables, así como se declaran en Python y que puede hacer con ellas más adelante. " 69 | 70 | # 6023dfa68c764ea991ca7a7912e7bceb 71 | #: ../../../source/variables.rst:31 72 | msgid "You can even use a variable to give the turtle a name::" 73 | msgstr "Puede incluso usar una variable para darle un nombre a la tortuga::" 74 | 75 | # 6c986c3906d34cd2a73d98485fa4d3e0 76 | #: ../../../source/variables.rst:35 77 | msgid "" 78 | "Now every time you type ``timmy`` it knows you mean ``turtle``. You can " 79 | "still continue to use ``turtle`` as well::" 80 | msgstr "Ahora, cada vez que escriba ``timmy`` Python sabe que usted quiere decir ``turtle``. Usted puede seguir usando ``turtle`` si lo desea::" 81 | 82 | # 855b759cf6614117812596f0572da969 83 | #: ../../../source/variables.rst:43 84 | msgid "A variable called angle" 85 | msgstr "Una variable llamada angle" 86 | 87 | # 341a0b4eab9c4060983a009910f9912b 88 | # c7f79c6a0e3f438c8cbddaeac9e3b967 89 | #: ../../../source/variables.rst:46 ../../../source/variables.rst:85 90 | msgid "Exercise" 91 | msgstr "Ejercicio" 92 | 93 | # 98036cab6adc4843be4121ad8a525a46 94 | #: ../../../source/variables.rst:48 95 | msgid "" 96 | "If we have a variable called ``angle``, how could we use that to experiment " 97 | "much faster with our tilted squares program?" 98 | msgstr "Si tenemos una variable llamada ``angle`` (ángulo en inglés), ¿cómo podemos usarla para experimentar más rápido con nuestro programa de cuadrados inclinados?" 99 | 100 | # 4f5e8724e9bf47bb9a308c96b099e1bd 101 | #: ../../../source/variables.rst:54 102 | msgid "Solution" 103 | msgstr "Solución" 104 | 105 | # e5cc56f2272342e2a9817063d345d126 106 | #: ../../../source/variables.rst:74 107 | msgid "... and so on" 108 | msgstr "... y así sucesivamente." 109 | 110 | # f88b19f8666e4f3699d3fa8a1d16eeeb 111 | #: ../../../source/variables.rst:77 112 | msgid "Bonus" 113 | msgstr "Bonus" 114 | 115 | # 1af525ffffc44dba842bbaac6875a109 116 | #: ../../../source/variables.rst:79 117 | msgid "Can you apply that principle to the size of the squares, too?" 118 | msgstr "¿Puede aplicar este principio para el tamaño de los cuadrados también?" 119 | 120 | # 860b1520bc564aae8f16cbeaf5723c13 121 | #: ../../../source/variables.rst:82 122 | msgid "The house of santa claus" 123 | msgstr "La casa del viejito pascuero" 124 | 125 | # 1d280501f67a473aad5e0d4531953a0d 126 | #: ../../../source/variables.rst:87 127 | msgid "Draw a house." 128 | msgstr "Dibuje una casa." 129 | 130 | # cf4fc858e79b449fbfe315cf438b5e39 131 | #: ../../../source/variables.rst:91 132 | msgid "" 133 | "You can calculate the length of the diagonal line with the Pythagorean " 134 | "theorem. That value is a good candidate to store in a variable. To calculate" 135 | " the square root of a number in Python, you'll need to import the *math* " 136 | "module and use the ``math.sqrt()`` function. The square of a number is " 137 | "calculated with the ``**`` operator::" 138 | msgstr "Puede calcular el largo de la diagonal con el teorema de Pitágoras. Ese valor es un buen candidato para ser guardado en una variable. Para calcular la raíz cuadrada de un número en Python, necesitará importar el módulo *math* y usar la función ``math.sqrt()``. El cuadrado de un número se calcula con el operador ``**``::" 139 | -------------------------------------------------------------------------------- /source/locale/de/LC_MESSAGES/variables.po: -------------------------------------------------------------------------------- 1 | # SOME DESCRIPTIVE TITLE. 2 | # Copyright (C) 2012–2014, OpenTechSchool and contributors 3 | # This file is distributed under the same license as the Introduction to Programming with Python package. 4 | # 5 | # Translators: 6 | # Kristian Rother , 2014 7 | # Kristian Rother , 2013 8 | # Robert Lehmann , 2013 9 | # Benjamin Kampmann , 2013 10 | # Robert Lehmann , 2013-2014 11 | msgid "" 12 | msgstr "" 13 | "Project-Id-Version: Python for beginners\n" 14 | "Report-Msgid-Bugs-To: \n" 15 | "POT-Creation-Date: 2014-06-09 11:00+1000\n" 16 | "PO-Revision-Date: 2014-02-25 07:01+0000\n" 17 | "Last-Translator: Robert Lehmann \n" 18 | "Language-Team: German (http://www.transifex.com/projects/p/python-for-beginners/language/de/)\n" 19 | "MIME-Version: 1.0\n" 20 | "Content-Type: text/plain; charset=UTF-8\n" 21 | "Content-Transfer-Encoding: 8bit\n" 22 | "Language: de\n" 23 | "Plural-Forms: nplurals=2; plural=(n != 1);\n" 24 | 25 | # 016333f418f04abb99e1f153b93d1733 26 | #: ../../../source/variables.rst:2 27 | msgid "Variables" 28 | msgstr "Variablen" 29 | 30 | # 2a00a8448498495ba72c8e5c1b7be5a3 31 | #: ../../../source/variables.rst:5 32 | msgid "Introduction" 33 | msgstr "Einführung" 34 | 35 | # 11e299324f7f446fb7fc1fe39af9ea9f 36 | #: ../../../source/variables.rst:7 37 | msgid "" 38 | "Whew. Experimenting with the angles requires you to change three different " 39 | "places in the code each time. Imagine you'd want to experiment with all of " 40 | "the square sizes, let alone with rectangles! We can do better than that." 41 | msgstr "Puh. Wenn Du mit den Winkeln experimentierst, musst Du jedes Mal an drei verschiedenen Stellen den Code verändern. Jetzt stelle Dir vor Du möchtest mit allen Abmessungen des Quadrates experimentieren, oder sogar mit Rechtecken! Das muss besser gehen." 42 | 43 | # a2712e5a1bf24c91bf73db77f5094695 44 | #: ../../../source/variables.rst:11 45 | msgid "" 46 | "This is where **variables** come into play: You can tell Python that from " 47 | "now on, whenever you refer to a variable, you actually mean something else. " 48 | "That concept might be familiar from symbolic maths, where you would write: " 49 | "*Let x be 5.* Then *x \\* 2* will obviously be *10*." 50 | msgstr "An dieser Stelle kommen **Variablen** ins Spiel: Du kannst ab nun Python befehlen, jedes Mal wenn Du eine bestimmte Variable verwendest, an dieser Stelle etwas anderes einzusetzen. Dieses Konzept ist ähnlich zur Algebra, wo Du schreiben könntest: *x sei 5*. Dann ist *x \\* 2* natürlich *10*." 51 | 52 | # fa0a962bd37d4e8eb7ba0ee69b28e8ee 53 | #: ../../../source/variables.rst:16 54 | msgid "In Python syntax, that very statement translates to::" 55 | msgstr "In der Syntax von Python hat die gleiche Bedeutung::" 56 | 57 | # 986235ce1d8b44ebb5dd81ce1b1abd75 58 | #: ../../../source/variables.rst:20 59 | msgid "" 60 | "After that statement, if you do ``print(x)``, it will actually output its " 61 | "value --- 5. Well, can use that for your turtle too::" 62 | msgstr "Falls Du nach diesem Befehl ``print(x)`` ausführst, wird der Wert von x ausgegeben --- 5. Du kannst das gleiche auch mit turtle kombinieren." 63 | 64 | # 41ee9fc89f5b45a8b560e9c5ddf7b512 65 | #: ../../../source/variables.rst:25 66 | msgid "" 67 | "Variables can store all sorts of things, not just numbers. A typical other " 68 | "thing you want to have stored often is a **string** - a line of text. " 69 | "Strings are indicated with a starting and a leading ``\"`` (double quote). " 70 | "You'll learn about this and other types, as those are called in Python, and " 71 | "what you can do with them later on." 72 | msgstr "Variablen können alles mögliche speichern, nicht nur Zahlen. Etwas anderes typisches das oft in Variablen gespeichert wird sind **Strings** - Textzeilen. Strings werden durch ``\"`` (doppelte Anführungszeichen) vor und nach dem Text gekennzeichnet. Du wirst später noch mehr über diese sogenannten Datentypen in Python und was Du mit ihnen tun kannst, lernen." 73 | 74 | # 6023dfa68c764ea991ca7a7912e7bceb 75 | #: ../../../source/variables.rst:31 76 | msgid "You can even use a variable to give the turtle a name::" 77 | msgstr "Du kannst sogar eine Variable verwenden um der Schildkröte einen Namen zu geben::" 78 | 79 | # 6c986c3906d34cd2a73d98485fa4d3e0 80 | #: ../../../source/variables.rst:35 81 | msgid "" 82 | "Now every time you type ``timmy`` it knows you mean ``turtle``. You can " 83 | "still continue to use ``turtle`` as well::" 84 | msgstr "Jedes Mal wenn Du nun ``timmy`` schreibst, weiß Python, dass Du ``turtle`` meinst. Du kannst auch weiterhin ``turtle`` verwenden::" 85 | 86 | # 855b759cf6614117812596f0572da969 87 | #: ../../../source/variables.rst:43 88 | msgid "A variable called angle" 89 | msgstr "Eine Variable genannt angle" 90 | 91 | # 341a0b4eab9c4060983a009910f9912b 92 | # c7f79c6a0e3f438c8cbddaeac9e3b967 93 | #: ../../../source/variables.rst:46 ../../../source/variables.rst:85 94 | msgid "Exercise" 95 | msgstr "Übung" 96 | 97 | # 98036cab6adc4843be4121ad8a525a46 98 | #: ../../../source/variables.rst:48 99 | msgid "" 100 | "If we have a variable called ``angle``, how could we use that to experiment " 101 | "much faster with our tilted squares program?" 102 | msgstr "Wenn wir eine Variable ``angle`` (Winkel) nennen, wie könnten wir sie verwenden um mit dem Programm mit den gekippten Quadraten zu experimentieren?" 103 | 104 | # 4f5e8724e9bf47bb9a308c96b099e1bd 105 | #: ../../../source/variables.rst:54 106 | msgid "Solution" 107 | msgstr "Lösung" 108 | 109 | # e5cc56f2272342e2a9817063d345d126 110 | #: ../../../source/variables.rst:74 111 | msgid "... and so on" 112 | msgstr "... und so weiter" 113 | 114 | # f88b19f8666e4f3699d3fa8a1d16eeeb 115 | #: ../../../source/variables.rst:77 116 | msgid "Bonus" 117 | msgstr "Bonus" 118 | 119 | # 1af525ffffc44dba842bbaac6875a109 120 | #: ../../../source/variables.rst:79 121 | msgid "Can you apply that principle to the size of the squares, too?" 122 | msgstr "Kannst Du das gleiche Prinzip auch auf die Grösse der Quadrate anwenden?" 123 | 124 | # 860b1520bc564aae8f16cbeaf5723c13 125 | #: ../../../source/variables.rst:82 126 | msgid "The house of santa claus" 127 | msgstr "Das Haus vom Nikolaus" 128 | 129 | # 1d280501f67a473aad5e0d4531953a0d 130 | #: ../../../source/variables.rst:87 131 | msgid "Draw a house." 132 | msgstr "Zeichne ein Haus." 133 | 134 | # cf4fc858e79b449fbfe315cf438b5e39 135 | #: ../../../source/variables.rst:91 136 | msgid "" 137 | "You can calculate the length of the diagonal line with the Pythagorean " 138 | "theorem. That value is a good candidate to store in a variable. To calculate" 139 | " the square root of a number in Python, you'll need to import the *math* " 140 | "module and use the ``math.sqrt()`` function. The square of a number is " 141 | "calculated with the ``**`` operator::" 142 | msgstr "Du kannst die Länge der diagonalen Linie mit dem Satz des Pythagoras ausrechnen. Diese Zahl ist es wert in einer Variable gespeichert zu werden. Um die Quadratwurzel einer Zahl in Python zu berechnen, musst Du das *math* Modul importieren und die Funktion ``math.sqrt()`` aufrufen. Das Quadrat einer Zahl kannst Du mit dem Operator ``**`` ausrechnen::" 143 | --------------------------------------------------------------------------------