{"id":1361,"date":"2021-08-30T22:33:22","date_gmt":"2021-08-30T21:33:22","guid":{"rendered":"https:\/\/www.lzych.pl\/?p=1361"},"modified":"2022-01-27T22:26:04","modified_gmt":"2022-01-27T21:26:04","slug":"python-tutorial-free-course-for-beginners-6-functions","status":"publish","type":"post","link":"https:\/\/www.lzych.pl\/en\/python-tutorial-free-course-for-beginners-6-functions\/","title":{"rendered":"Python &#8211; bezp\u0142atny kurs dla pocz\u0105tkuj\u0105cych #6, Funkcje"},"content":{"rendered":"<div data-elementor-type=\"wp-post\" data-elementor-id=\"1361\" class=\"elementor elementor-1361\" data-elementor-settings=\"[]\">\n\t\t\t\t\t\t<div class=\"elementor-inner\">\n\t\t\t\t\t\t\t<div class=\"elementor-section-wrap\">\n\t\t\t\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-89b4ce2 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"89b4ce2\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t\t\t<div class=\"elementor-row\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-bbd70c7\" data-id=\"bbd70c7\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-column-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t<div class=\"elementor-widget-wrap\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-620032e elementor-widget elementor-widget-heading\" data-id=\"620032e\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">Po co s\u0105 funkcje?<\/h2>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-11d57e4 elementor-widget elementor-widget-text-editor\" data-id=\"11d57e4\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-text-editor elementor-clearfix\">\n\t\t\t\t<p><span style=\"font-family: var e-global-typography-text-font-family, Sans-serif;\">Do tej pory korzystali\u015bmy ju\u017c z r\u00f3\u017cnych funkcji wbudowanych w pythona takich jak \u2018print()\u2019 czy \u2018range()\u2019.<\/span><\/p><p><span style=\"font-family: var e-global-typography-text-font-family, Sans-serif;\">W tej sekcji nauczymy si\u0119 jak tworzy\u0107 w\u0142asne funkcje. Kiedy budujemy du\u017cy, komercyjny program mo\u017ce on zawiera\u0107 setki tysi\u0119cy linii kodu. Gdyby\u015bmy umie\u015bcili go w ca\u0142o\u015bci w jednym pliku by\u0142oby niesamowicie trudno przy nim pracowa\u0107 \u2013 znalezienie tam czegokolwiek by\u0142oby koszmarem.<\/span><\/p><p><span style=\"font-family: var e-global-typography-text-font-family, Sans-serif;\">Funkcja jest wydzielon\u0105 cz\u0119\u015bci\u0105 kodu, kt\u00f3ra realizuje zawarte w niej instrukcje. Dzi\u0119ki niej mo\u017cemy:<\/span><\/p><ul><li><span style=\"font-family: 'var e-global-typography-text-font-family', sans-serif;\">unikn\u0105\u0107 powt\u00f3rze\u0144 \u2013 nie ma sensu kopiowa\u0107 kilka razy tego samego kodu, bo jak co\u015b si\u0119 zmieni, to znowu w kilku miejscach b\u0119dziemy musieli tego szuka\u0107 i poprawia\u0107. \u0141atwo te\u017c zapomnie\u0107, \u017ce co\u015b gdzie\u015b skopiowali\u015bmy,<\/span><\/li><li>\u0142atwo zarz\u0105dza\u0107 kodem \u2013 skoro cz\u0119\u015b\u0107 kodu zostanie wydzielona, to wiemy dok\u0142adnie za co odpowiada. Gdy co\u015b si\u0119 popsuje to wiemy gdzie si\u0119 uda\u0107.<\/li><\/ul>\t\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-3b73a95 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"3b73a95\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t\t\t<div class=\"elementor-row\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-50 elementor-top-column elementor-element elementor-element-834027e\" data-id=\"834027e\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-column-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t<div class=\"elementor-widget-wrap\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-87e1e55 elementor-widget elementor-widget-text-editor\" data-id=\"87e1e55\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-text-editor elementor-clearfix\">\n\t\t\t\t<p><span style=\"font-family: var e-global-typography-text-font-family, Sans-serif;\">Tak jak pilot do telewizora posiada wiele przycisk\u00f3w, kt\u00f3re po klikni\u0119ciu uruchamiaj\u0105 r\u00f3\u017cne funkcje np. zmieniaj\u0105 kana\u0142, w\u0142\u0105czaj\u0105 tv, zwi\u0119kszaj\u0105 g\u0142o\u015bno\u015b\u0107 itd. tak wy\u017cej wspomniana funkcja \u2018print()\u2019 zajmuje si\u0119 wypisywaniem wybranej warto\u015bci w terminalu.<\/span><\/p><p><span style=\"font-family: var e-global-typography-text-font-family, Sans-serif;\">Dzisiaj nauczymy si\u0119 pisa\u0107 nasze w\u0142asne funkcje \ud83d\ude42<\/span><\/p>\t\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t<div class=\"elementor-column elementor-col-50 elementor-top-column elementor-element elementor-element-adf04e2\" data-id=\"adf04e2\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-column-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t<div class=\"elementor-widget-wrap\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-f2ce11b elementor-widget elementor-widget-html\" data-id=\"f2ce11b\" data-element_type=\"widget\" data-widget_type=\"html.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<iframe loading=\"lazy\" src=\"https:\/\/giphy.com\/embed\/zlLydol7ndM7C\" width=\"480\" height=\"270\" frameborder=\"0\" class=\"giphy-embed\" allowfullscreen><\/iframe><p><a href=\"https:\/\/giphy.com\/gifs\/remote-zlLydol7ndM7C\">via GIPHY<\/a><\/p>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-96511e0 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"96511e0\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t\t\t<div class=\"elementor-row\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-0db878e\" data-id=\"0db878e\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-column-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t<div class=\"elementor-widget-wrap\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-98d8160 elementor-widget elementor-widget-heading\" data-id=\"98d8160\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">W\u0142asne funkcje<\/h2>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-d72d388 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"d72d388\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t\t\t<div class=\"elementor-row\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-50 elementor-top-column elementor-element elementor-element-21e3dcd\" data-id=\"21e3dcd\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-column-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t<div class=\"elementor-widget-wrap\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-6651b94 elementor-widget elementor-widget-text-editor\" data-id=\"6651b94\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-text-editor elementor-clearfix\">\n\t\t\t\t<p><span style=\"font-family: var e-global-typography-text-font-family, Sans-serif;\">Funkcj\u0119 oznaczamy s\u0142owem kluczowym \u201c<\/span><span style=\"font-family: var e-global-typography-text-font-family, Sans-serif;\"><strong>def<\/strong><\/span><span style=\"font-family: var e-global-typography-text-font-family, Sans-serif;\">\u201d\u00a0(skr\u00f3t od define), po tym wpisujemy nasz\u0105 wybran\u0105 nazw\u0119 funkcji, a na ko\u0144cu umieszczamy \u201c():\u201d. W wierszu poni\u017cej zaczynamy od wci\u0119cia \u2013 wci\u0119cie jest kluczowe, poniewa\u017c oznacza, \u017ce kod kt\u00f3ry si\u0119 tutaj znajduje nale\u017cy do funkcji.<\/span><\/p><p><span style=\"font-family: var e-global-typography-text-font-family, Sans-serif;\">Koniec funkcji w pythonie oznaczamy robi\u0105c dwa wiersze odst\u0119pu \u2013 koniecznie o tym pami\u0119taj, poniewa\u017c w przeciwnym razie mo\u017cesz wci\u0105gn\u0105\u0107 do funkcji kod, kt\u00f3rego tam nie chcesz \ud83d\ude42<\/span><\/p><p><span style=\"font-family: var e-global-typography-text-font-family, Sans-serif;\">Na sam koniec musimy funkcj\u0119 wywo\u0142a\u0107. To tak jak z pilotem do telewizora \u2013 musimy klikn\u0105\u0107 przycisk, \u017ceby co\u015b si\u0119 sta\u0142o. Nawet jak napiszemy sobie funkcj\u0119, ale jej nie wywo\u0142amy (nie klikniemy tego przycisku w pilocie), to nic si\u0119 nie stanie.<\/span><\/p>\t\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t<div class=\"elementor-column elementor-col-50 elementor-top-column elementor-element elementor-element-e22e202\" data-id=\"e22e202\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-column-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t<div class=\"elementor-widget-wrap\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-9dfb663 elementor-widget elementor-widget-text-editor\" data-id=\"9dfb663\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-text-editor elementor-clearfix\">\n\t\t\t\t<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\"># our first function\ndef greeting():\n    print('Hello there!')\n    print('How are you?')\n\n\n# function call\ngreeting()\n\n# result:\n# Hello there!\n# How are you?\n<\/pre>\t\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-15ccb5d elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"15ccb5d\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t\t\t<div class=\"elementor-row\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-1258173\" data-id=\"1258173\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-column-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t<div class=\"elementor-widget-wrap\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-f4bcbde elementor-widget elementor-widget-heading\" data-id=\"f4bcbde\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">Przekazywanie argument\u00f3w do funkcji<\/h2>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-4d6f355 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"4d6f355\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t\t\t<div class=\"elementor-row\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-50 elementor-top-column elementor-element elementor-element-b2b7d01\" data-id=\"b2b7d01\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-column-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t<div class=\"elementor-widget-wrap\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-45726be elementor-widget elementor-widget-text-editor\" data-id=\"45726be\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-text-editor elementor-clearfix\">\n\t\t\t\t<p><span style=\"font-family: var e-global-typography-text-font-family, Sans-serif;\">Powy\u017csza funkcja jest ca\u0142kiem w porz\u0105dku, ale mo\u017cemy chcie\u0107, aby wita\u0142a ka\u017cd\u0105 osob\u0119 po imieniu. Mo\u017cemy to zrobi\u0107, dodaj\u0105c do funkcji parametry, kt\u00f3re p\u00f3\u017aniej mo\u017cna przekaza\u0107 przy jej wywo\u0142aniu. Przekazuj\u0105c je, nazywamy je argumentami.<\/span><\/p>\t\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t<div class=\"elementor-column elementor-col-50 elementor-top-column elementor-element elementor-element-e7b96a2\" data-id=\"e7b96a2\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-column-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t<div class=\"elementor-widget-wrap\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-3f8146b elementor-widget elementor-widget-text-editor\" data-id=\"3f8146b\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-text-editor elementor-clearfix\">\n\t\t\t\t<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\">def greeting(name):\n    print(f'Hello there {name}!')\n\n\n# function call\ngreeting('Fred')\n# another call of the same function\ngreeting('Anna')\n\n# result:\n# Hello there Fred!\n# Hello there Anna!\n<\/pre>\t\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-21e9c69 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"21e9c69\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t\t\t<div class=\"elementor-row\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-50 elementor-top-column elementor-element elementor-element-1434664\" data-id=\"1434664\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-column-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t<div class=\"elementor-widget-wrap\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-44b74d0 elementor-widget elementor-widget-text-editor\" data-id=\"44b74d0\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-text-editor elementor-clearfix\">\n\t\t\t\tMo\u017cemy ustawi\u0107 wiele parametr\u00f3w, kt\u00f3re b\u0119dzie mo\u017cna przekaza\u0107 do funkcji \u2013 wszystko zale\u017cy co konkretnie potrzebujemy.\t\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t<div class=\"elementor-column elementor-col-50 elementor-top-column elementor-element elementor-element-d7ddcfc\" data-id=\"d7ddcfc\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-column-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t<div class=\"elementor-widget-wrap\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-de488b7 elementor-widget elementor-widget-text-editor\" data-id=\"de488b7\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-text-editor elementor-clearfix\">\n\t\t\t\t<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\"># function with 2 params\ndef greeting(name, age):\n    print(f'Hello there {name} at the age of {age}! ')\n\n\n# function call\ngreeting('Fred', 20)\ngreeting('Anna', 40)\n\n# result:\n# Hello there Fred at the age of 20!\n# Hello there Anna at the age of 40!\n<\/pre>\t\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-e6c3725 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"e6c3725\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t\t\t<div class=\"elementor-row\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-50 elementor-top-column elementor-element elementor-element-cfe5b3e\" data-id=\"cfe5b3e\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-column-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t<div class=\"elementor-widget-wrap\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-d37f181 elementor-widget elementor-widget-text-editor\" data-id=\"d37f181\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-text-editor elementor-clearfix\">\n\t\t\t\t<p><span style=\"font-family: var e-global-typography-text-font-family, Sans-serif;\">Wa\u017cn\u0105 informacj\u0105 jest r\u00f3wnie\u017c to, \u017ce mo\u017cemy okre\u015bli\u0107 domy\u015blne warto\u015bci dla ka\u017cdego parametru, bo na przyk\u0142ad nie zawsze b\u0119dzie on nam potrzebny, albo wyst\u0119puje bardzo cz\u0119sto i nie chcemy za ka\u017cdym razem go przekazywa\u0107, tylko wtedy gdy b\u0119dzie on si\u0119 r\u00f3\u017cni\u0142. Wtedy parametry, kt\u00f3re maj\u0105 domy\u015blne warto\u015bci musz\u0105 znajdowa\u0107 si\u0119 na ko\u0144cu. To znaczy, \u017ce tworz\u0105c funkcj\u0119 kt\u00f3ra ma domy\u015ble parametry, najpierw okre\u015blamy te, kt\u00f3re nie maj\u0105 warto\u015bci domy\u015blnych, a dopiero potem te, kt\u00f3re je posiadaj\u0105.<\/span><\/p>\t\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t<div class=\"elementor-column elementor-col-50 elementor-top-column elementor-element elementor-element-122ec67\" data-id=\"122ec67\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-column-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t<div class=\"elementor-widget-wrap\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-d0d8b02 elementor-widget elementor-widget-text-editor\" data-id=\"d0d8b02\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-text-editor elementor-clearfix\">\n\t\t\t\t<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\"># function with 3 params, the last one has default value\ndef greeting(name, age, city='Warsaw'):\n    print(f'Hi {name} at the age of {age} from {city}! ')\n\n\n# we pass 2 arguments, so 3rd value will be default\ngreeting('Fred', 20)\n# we pass 3 arguments, so 3rd value will be overwritten\ngreeting('Anna', 40, 'London')\n\n# result:\n# Hi Fred at the age of 20 from Warsaw! \n# Hi Anna at the age of 40 from London!\n<\/pre>\t\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-8050718 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"8050718\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t\t\t<div class=\"elementor-row\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-374e592\" data-id=\"374e592\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-column-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t<div class=\"elementor-widget-wrap\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-97bfb24 elementor-widget elementor-widget-heading\" data-id=\"97bfb24\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">Typy funkcji<\/h2>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-1ddc1b7 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"1ddc1b7\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t\t\t<div class=\"elementor-row\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-1c100d2\" data-id=\"1c100d2\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-column-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t<div class=\"elementor-widget-wrap\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-cac73b9 elementor-widget elementor-widget-text-editor\" data-id=\"cac73b9\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-text-editor elementor-clearfix\">\n\t\t\t\t<p><span style=\"font-family: var e-global-typography-text-font-family, Sans-serif;\">Funkcje dzielimy na dwa typy:<\/span><\/p><ul><li><span style=\"font-family: 'var e-global-typography-text-font-family', sans-serif;\">takie, kt\u00f3re wykonuj\u0105 okre\u015blone zadanie,<\/span><\/li><li>zwracaj\u0105 warto\u015b\u0107.<\/li><\/ul><p><span style=\"font-family: var e-global-typography-text-font-family, Sans-serif;\"><strong>Funkcje wykonuj\u0105ce okre\u015blone zadanie<\/strong><\/span><\/p><p><span style=\"font-family: var e-global-typography-text-font-family, Sans-serif;\">Przyk\u0142adem s\u0105 wszystkie funkcje, kt\u00f3re wypisywali\u015bmy powy\u017cej. Ich zadaniem by\u0142o wypisanie tekstu powitania\u00a0 z dan\u0105 osob\u0105. Jak to zrobione, zadanie zostaje zako\u0144czone. Innym przyk\u0142adem mo\u017ce by\u0107 te\u017c funkcja zmieniaj\u0105ca kana\u0142 w pilocie do telewizora \u2013 po klikni\u0119ciu zmieni kana\u0142, zadanie wykonane.<\/span><\/p><p><span style=\"font-family: var e-global-typography-text-font-family, Sans-serif;\"><strong>Funkcje zwracaj\u0105ce warto\u015b\u0107<\/strong><\/span><\/p><p><span style=\"font-family: var e-global-typography-text-font-family, Sans-serif;\">Mo\u017ce si\u0119 zdarzy\u0107 tak, \u017ce:<\/span><\/p><ul><li><span style=\"font-family: 'var e-global-typography-text-font-family', sans-serif;\">robimy aplikacj\u0119 naszego w\u0142asnego kalkulatora i potrzebujemy funkcji kt\u00f3ra nam policzy wynik,<\/span><\/li><li>albo aplikacj\u0119 dla tajnych agent\u00f3w, kt\u00f3rzy zamiast pe\u0142nych imion, u\u017cywaj\u0105 tylko pierwszej litery swojego imienia, wi\u0119c potrzebujemy tylko tej pierwszej literki,<\/li><li>albo pomagamy w odszyfrowaniu zgubionego has\u0142a i szukamy tylko tego jednego kt\u00f3re pasuje.<\/li><\/ul><p><span style=\"font-family: var e-global-typography-text-font-family, Sans-serif;\">\u0141\u0105czy je to, \u017ce wynik dzia\u0142ania funkcji b\u0119dziemy mogli zapisa\u0107 sobie w zmiennej. Dzi\u0119ki temu, p\u00f3\u017aniej mo\u017cemy dalej jej u\u017cy\u0107, najcz\u0119\u015bciej w innych funkcjach.<\/span><\/p>\t\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-a7d9a26 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"a7d9a26\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t\t\t<div class=\"elementor-row\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-82f4c91\" data-id=\"82f4c91\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-column-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t<div class=\"elementor-widget-wrap\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-92eba36 elementor-widget elementor-widget-heading\" data-id=\"92eba36\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">Funkcje zwracaj\u0105ce warto\u015b\u0107<\/h2>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-69199af elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"69199af\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t\t\t<div class=\"elementor-row\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-50 elementor-top-column elementor-element elementor-element-b4eeca9\" data-id=\"b4eeca9\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-column-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t<div class=\"elementor-widget-wrap\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-996dcd3 elementor-widget elementor-widget-text-editor\" data-id=\"996dcd3\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-text-editor elementor-clearfix\">\n\t\t\t\t<p><span style=\"font-family: var e-global-typography-text-font-family, Sans-serif;\">Funkcje kt\u00f3re chcemy, aby zwraca\u0142y obliczon\u0105 warto\u015b\u0107, tworzymy tak samo jak ka\u017cd\u0105 funkcj\u0119. Jedyna r\u00f3\u017cnica polega na tym, \u017ce na ko\u0144cu tej funkcji musimy napisa\u0107 co ona ma konkretnie zwr\u00f3ci\u0107. To miejsce oznaczamy s\u0142owem \u201c<\/span><span style=\"font-family: var e-global-typography-text-font-family, Sans-serif;\"><strong>return<\/strong><\/span><span style=\"font-family: var e-global-typography-text-font-family, Sans-serif;\">\u201c.<\/span><\/p><p><span style=\"font-family: var e-global-typography-text-font-family, Sans-serif;\">S\u0142owo return, ko\u0144czy dzia\u0142anie funkcji w miejscu, w kt\u00f3rym zosta\u0142o wywo\u0142ane. To znaczy, \u017ce je\u017celi Tw\u00f3j kod dojdzie do miejsca, gdzie znajduje si\u0119 \u201creturn\u201d, a pod nim umie\u015bcisz co\u015b jeszcze, to nie zostanie to wywo\u0142ane.<\/span><\/p><p><span style=\"font-family: var e-global-typography-text-font-family, Sans-serif;\">W zwi\u0105zku z tym return zazwyczaj umieszcza si\u0119 na samym ko\u0144cu funkcji \u2013 musisz o tym pami\u0119ta\u0107.<\/span><\/p>\t\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t<div class=\"elementor-column elementor-col-50 elementor-top-column elementor-element elementor-element-5d3abf0\" data-id=\"5d3abf0\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-column-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t<div class=\"elementor-widget-wrap\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-58d0816 elementor-widget elementor-widget-text-editor\" data-id=\"58d0816\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-text-editor elementor-clearfix\">\n\t\t\t\t<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\"># first ordinary function which has two params\ndef greeting(name, age):\n    print(f'Hi {name}, you are {age} old!')\n\n\n# function which returns value\n# we don't print anything, we just calculate an age\n# by subtracting the year from the date of birth\ndef calculate_age(date_of_birth):\n    current_year = 2021\n    return current_year - date_of_birth\n\n\n# Example usage:\n\n# we save the result in a variable\n# so that we can use it few times\nfred_age = calculate_age(1980)\n\nprint(f'The age that we calculated is: {fred_age}')\n\n# we can also pass it to another function\ngreeting('Fred', fred_age)\n\n# ============================\n# result:\n# The age that we calculated is: 41\n# Hi Fred, you are 41 old!\n<\/pre>\t\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-3f25a7f elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"3f25a7f\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t\t\t<div class=\"elementor-row\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-a69cc9f\" data-id=\"a69cc9f\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-column-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t<div class=\"elementor-widget-wrap\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-2346777 elementor-widget-divider--view-line elementor-widget elementor-widget-divider\" data-id=\"2346777\" data-element_type=\"widget\" data-widget_type=\"divider.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<div class=\"elementor-divider\">\n\t\t\t<span class=\"elementor-divider-separator\">\n\t\t\t\t\t\t<\/span>\n\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-73cdd1e elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"73cdd1e\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t\t\t<div class=\"elementor-row\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-50 elementor-top-column elementor-element elementor-element-d646f35\" data-id=\"d646f35\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-column-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t<div class=\"elementor-widget-wrap\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-9af3ff3 elementor-widget elementor-widget-html\" data-id=\"9af3ff3\" data-element_type=\"widget\" data-widget_type=\"html.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<iframe loading=\"lazy\" src=\"https:\/\/giphy.com\/embed\/W35DnRbN4oDHIAApdk\" width=\"480\" height=\"480\" frameborder=\"0\" class=\"giphy-embed\" allowfullscreen><\/iframe><p><a href=\"https:\/\/giphy.com\/gifs\/rickandmorty-season-1-adult-swim-rick-and-morty-W35DnRbN4oDHIAApdk\">via GIPHY<\/a><\/p>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t<div class=\"elementor-column elementor-col-50 elementor-top-column elementor-element elementor-element-d23b589\" data-id=\"d23b589\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-column-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t<div class=\"elementor-widget-wrap\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-1d1940a elementor-widget elementor-widget-text-editor\" data-id=\"1d1940a\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-text-editor elementor-clearfix\">\n\t\t\t\t<p>Funkcje s\u0105 kluczowe w programowaniu i s\u0105 u\u017cywane dos\u0142ownie wsz\u0119dzie. Dzi\u0119ki ich zrozumieniu zdecydowanie poszerzasz swoj\u0105 programistyczn\u0105 wiedz\u0119! Gratulacje! \ud83d\ude42<\/p><p><span style=\"color: #7a7a7a;\"><span style=\"font-family: Roboto, sans-serif;\"><span style=\"font-size: medium;\">Spr\u00f3buj po\u0107wiczy\u0107 zdobyt\u0105 dzisiaj wiedz\u0119, stw\u00f3rz:<\/span><\/span><\/span><\/p><ul><li><span style=\"font-size: medium; font-family: Roboto, sans-serif; color: #7a7a7a;\">funkcj\u0119, kt\u00f3ra dodaje do siebie dwie liczby, dodaje do tego jeszcze 10 i zwraca wynik,<\/span><\/li><\/ul><ul><li><span style=\"font-size: medium; font-family: Roboto, sans-serif; color: #7a7a7a;\">funkcj\u0119, kt\u00f3ra przyjmuje w parametrach imi\u0119 i miasto (ustaw warto\u015b\u0107 domy\u015bln\u0105 na \u2018Warsaw\u2019), wybiera pierwsz\u0105 literk\u0119 ka\u017cdego z nich, \u0142\u0105czy je i zwraca.<\/span><\/li><\/ul><p><span style=\"color: #7a7a7a;\"><span style=\"font-family: Roboto, sans-serif;\"><span style=\"font-size: medium;\">W nast\u0119pnej lekcji napisz\u0119 jeszcze kilka ciekawych rzeczy o funkcjach. Nie przegap tego!<\/span><\/span><\/span><\/p><p><span style=\"color: #7a7a7a;\"><span style=\"font-family: Roboto, sans-serif;\"><span style=\"font-size: medium;\">Nie zapomnij polubi\u0107\u00a0<\/span><\/span><\/span><a href=\"https:\/\/www.facebook.com\/lz.programming.courses\"><span style=\"color: #7a7a7a;\"><span style=\"font-family: Roboto, sans-serif;\"><span style=\"font-size: medium;\"><strong>stron\u0119 na facebooku<\/strong><\/span><\/span><\/span><\/a><span style=\"color: #7a7a7a;\"><span style=\"font-family: Roboto, sans-serif;\"><span style=\"font-size: medium;\">\u00a0i zapisa\u0107 si\u0119 do\u00a0<\/span><\/span><\/span><a href=\"https:\/\/www.lzych.pl\/en\/pl\/blog\/\"><span style=\"color: #7a7a7a;\"><span style=\"font-family: Roboto, sans-serif;\"><span style=\"font-size: medium;\"><strong>newsletter&#8217;a<\/strong><\/span><\/span><\/span><\/a><span style=\"color: #7a7a7a;\"><span style=\"font-family: Roboto, sans-serif;\"><span style=\"font-size: medium;\"><strong>\u00a0<\/strong><\/span><\/span><\/span><span style=\"color: #7a7a7a;\"><span style=\"font-family: Roboto, sans-serif;\"><span style=\"font-size: medium;\">aby dosta\u0107 informacj\u0119 o kolejnych \u015bwietnych lekcjach!<\/span><\/span><\/span><\/p>\t\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-66389ec elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"66389ec\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t\t\t<div class=\"elementor-row\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-4694769\" data-id=\"4694769\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-column-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t<div class=\"elementor-widget-wrap\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-50dfc8e elementor-align-center elementor-widget elementor-widget-button\" data-id=\"50dfc8e\" data-element_type=\"widget\" data-widget_type=\"button.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<div class=\"elementor-button-wrapper\">\n\t\t\t<a href=\"https:\/\/www.lzych.pl\/en\/python-tutorial-free-course-for-beginners-7-scope\/\" class=\"elementor-button-link elementor-button elementor-size-sm\" role=\"button\">\n\t\t\t\t\t\t<span class=\"elementor-button-content-wrapper\">\n\t\t\t\t\t\t<span class=\"elementor-button-text\">Nast\u0119pna lekcja<\/span>\n\t\t<\/span>\n\t\t\t\t\t<\/a>\n\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>","protected":false},"excerpt":{"rendered":"<p>Po co s\u0105 funkcje? Do tej pory korzystali\u015bmy ju\u017c z r\u00f3\u017cnych funkcji wbudowanych w pythona takich jak \u2018print()\u2019 czy \u2018range()\u2019. W tej sekcji nauczymy si\u0119 jak tworzy\u0107 w\u0142asne funkcje. Kiedy budujemy du\u017cy, komercyjny program mo\u017ce on zawiera\u0107 setki tysi\u0119cy linii kodu. Gdyby\u015bmy umie\u015bcili go w ca\u0142o\u015bci w jednym pliku by\u0142oby niesamowicie trudno przy nim pracowa\u0107 [&hellip;]<\/p>","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[22],"tags":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v18.5.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Python - bezp\u0142atny kurs dla pocz\u0105tkuj\u0105cych #6, Funkcje - \u0141ukasz Zych<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.lzych.pl\/en\/python-tutorial-free-course-for-beginners-6-functions\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Python - bezp\u0142atny kurs dla pocz\u0105tkuj\u0105cych #6, Funkcje - \u0141ukasz Zych\" \/>\n<meta property=\"og:description\" content=\"Po co s\u0105 funkcje? Do tej pory korzystali\u015bmy ju\u017c z r\u00f3\u017cnych funkcji wbudowanych w pythona takich jak \u2018print()\u2019 czy \u2018range()\u2019. W tej sekcji nauczymy si\u0119 jak tworzy\u0107 w\u0142asne funkcje. Kiedy budujemy du\u017cy, komercyjny program mo\u017ce on zawiera\u0107 setki tysi\u0119cy linii kodu. Gdyby\u015bmy umie\u015bcili go w ca\u0142o\u015bci w jednym pliku by\u0142oby niesamowicie trudno przy nim pracowa\u0107 [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.lzych.pl\/en\/python-tutorial-free-course-for-beginners-6-functions\/\" \/>\n<meta property=\"og:site_name\" content=\"\u0141ukasz Zych\" \/>\n<meta property=\"article:published_time\" content=\"2021-08-30T21:33:22+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-01-27T21:26:04+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"lukasz\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.lzych.pl\/#website\",\"url\":\"https:\/\/www.lzych.pl\/\",\"name\":\"\u0141ukasz Zych\",\"description\":\"Aplikacje webowe, natywne, strony internetowe, boty\",\"publisher\":{\"@id\":\"https:\/\/www.lzych.pl\/#\/schema\/person\/1d55d960423b466c5aa2246be5086c56\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.lzych.pl\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.lzych.pl\/python-tutorial-free-course-for-beginners-6-functions\/#webpage\",\"url\":\"https:\/\/www.lzych.pl\/python-tutorial-free-course-for-beginners-6-functions\/\",\"name\":\"Python - bezp\u0142atny kurs dla pocz\u0105tkuj\u0105cych #6, Funkcje - \u0141ukasz Zych\",\"isPartOf\":{\"@id\":\"https:\/\/www.lzych.pl\/#website\"},\"datePublished\":\"2021-08-30T21:33:22+00:00\",\"dateModified\":\"2022-01-27T21:26:04+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.lzych.pl\/python-tutorial-free-course-for-beginners-6-functions\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.lzych.pl\/python-tutorial-free-course-for-beginners-6-functions\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.lzych.pl\/python-tutorial-free-course-for-beginners-6-functions\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.lzych.pl\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Python &#8211; bezp\u0142atny kurs dla pocz\u0105tkuj\u0105cych #6, Funkcje\"}]},{\"@type\":\"Article\",\"@id\":\"https:\/\/www.lzych.pl\/python-tutorial-free-course-for-beginners-6-functions\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.lzych.pl\/python-tutorial-free-course-for-beginners-6-functions\/#webpage\"},\"author\":{\"@id\":\"https:\/\/www.lzych.pl\/#\/schema\/person\/1d55d960423b466c5aa2246be5086c56\"},\"headline\":\"Python &#8211; bezp\u0142atny kurs dla pocz\u0105tkuj\u0105cych #6, Funkcje\",\"datePublished\":\"2021-08-30T21:33:22+00:00\",\"dateModified\":\"2022-01-27T21:26:04+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.lzych.pl\/python-tutorial-free-course-for-beginners-6-functions\/#webpage\"},\"wordCount\":903,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.lzych.pl\/#\/schema\/person\/1d55d960423b466c5aa2246be5086c56\"},\"articleSection\":[\"Kurs Python'a dla pocz\u0105tkuj\u0105cych\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.lzych.pl\/python-tutorial-free-course-for-beginners-6-functions\/#respond\"]}]},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/www.lzych.pl\/#\/schema\/person\/1d55d960423b466c5aa2246be5086c56\",\"name\":\"lukasz\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/www.lzych.pl\/#personlogo\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/56a3d931c6dc7b4ba8141eab2d044a56?s=96&d=retro&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/56a3d931c6dc7b4ba8141eab2d044a56?s=96&d=retro&r=g\",\"caption\":\"lukasz\"},\"logo\":{\"@id\":\"https:\/\/www.lzych.pl\/#personlogo\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Python - bezp\u0142atny kurs dla pocz\u0105tkuj\u0105cych #6, Funkcje - \u0141ukasz Zych","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.lzych.pl\/en\/python-tutorial-free-course-for-beginners-6-functions\/","og_locale":"en_US","og_type":"article","og_title":"Python - bezp\u0142atny kurs dla pocz\u0105tkuj\u0105cych #6, Funkcje - \u0141ukasz Zych","og_description":"Po co s\u0105 funkcje? Do tej pory korzystali\u015bmy ju\u017c z r\u00f3\u017cnych funkcji wbudowanych w pythona takich jak \u2018print()\u2019 czy \u2018range()\u2019. W tej sekcji nauczymy si\u0119 jak tworzy\u0107 w\u0142asne funkcje. Kiedy budujemy du\u017cy, komercyjny program mo\u017ce on zawiera\u0107 setki tysi\u0119cy linii kodu. Gdyby\u015bmy umie\u015bcili go w ca\u0142o\u015bci w jednym pliku by\u0142oby niesamowicie trudno przy nim pracowa\u0107 [&hellip;]","og_url":"https:\/\/www.lzych.pl\/en\/python-tutorial-free-course-for-beginners-6-functions\/","og_site_name":"\u0141ukasz Zych","article_published_time":"2021-08-30T21:33:22+00:00","article_modified_time":"2022-01-27T21:26:04+00:00","twitter_card":"summary_large_image","twitter_misc":{"Written by":"lukasz","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebSite","@id":"https:\/\/www.lzych.pl\/#website","url":"https:\/\/www.lzych.pl\/","name":"\u0141ukasz Zych","description":"Aplikacje webowe, natywne, strony internetowe, boty","publisher":{"@id":"https:\/\/www.lzych.pl\/#\/schema\/person\/1d55d960423b466c5aa2246be5086c56"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.lzych.pl\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.lzych.pl\/python-tutorial-free-course-for-beginners-6-functions\/#webpage","url":"https:\/\/www.lzych.pl\/python-tutorial-free-course-for-beginners-6-functions\/","name":"Python - bezp\u0142atny kurs dla pocz\u0105tkuj\u0105cych #6, Funkcje - \u0141ukasz Zych","isPartOf":{"@id":"https:\/\/www.lzych.pl\/#website"},"datePublished":"2021-08-30T21:33:22+00:00","dateModified":"2022-01-27T21:26:04+00:00","breadcrumb":{"@id":"https:\/\/www.lzych.pl\/python-tutorial-free-course-for-beginners-6-functions\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.lzych.pl\/python-tutorial-free-course-for-beginners-6-functions\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.lzych.pl\/python-tutorial-free-course-for-beginners-6-functions\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.lzych.pl\/"},{"@type":"ListItem","position":2,"name":"Python &#8211; bezp\u0142atny kurs dla pocz\u0105tkuj\u0105cych #6, Funkcje"}]},{"@type":"Article","@id":"https:\/\/www.lzych.pl\/python-tutorial-free-course-for-beginners-6-functions\/#article","isPartOf":{"@id":"https:\/\/www.lzych.pl\/python-tutorial-free-course-for-beginners-6-functions\/#webpage"},"author":{"@id":"https:\/\/www.lzych.pl\/#\/schema\/person\/1d55d960423b466c5aa2246be5086c56"},"headline":"Python &#8211; bezp\u0142atny kurs dla pocz\u0105tkuj\u0105cych #6, Funkcje","datePublished":"2021-08-30T21:33:22+00:00","dateModified":"2022-01-27T21:26:04+00:00","mainEntityOfPage":{"@id":"https:\/\/www.lzych.pl\/python-tutorial-free-course-for-beginners-6-functions\/#webpage"},"wordCount":903,"commentCount":0,"publisher":{"@id":"https:\/\/www.lzych.pl\/#\/schema\/person\/1d55d960423b466c5aa2246be5086c56"},"articleSection":["Kurs Python'a dla pocz\u0105tkuj\u0105cych"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.lzych.pl\/python-tutorial-free-course-for-beginners-6-functions\/#respond"]}]},{"@type":["Person","Organization"],"@id":"https:\/\/www.lzych.pl\/#\/schema\/person\/1d55d960423b466c5aa2246be5086c56","name":"lukasz","image":{"@type":"ImageObject","@id":"https:\/\/www.lzych.pl\/#personlogo","inLanguage":"en-US","url":"https:\/\/secure.gravatar.com\/avatar\/56a3d931c6dc7b4ba8141eab2d044a56?s=96&d=retro&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/56a3d931c6dc7b4ba8141eab2d044a56?s=96&d=retro&r=g","caption":"lukasz"},"logo":{"@id":"https:\/\/www.lzych.pl\/#personlogo"}}]}},"_links":{"self":[{"href":"https:\/\/www.lzych.pl\/en\/wp-json\/wp\/v2\/posts\/1361"}],"collection":[{"href":"https:\/\/www.lzych.pl\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.lzych.pl\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.lzych.pl\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.lzych.pl\/en\/wp-json\/wp\/v2\/comments?post=1361"}],"version-history":[{"count":47,"href":"https:\/\/www.lzych.pl\/en\/wp-json\/wp\/v2\/posts\/1361\/revisions"}],"predecessor-version":[{"id":1616,"href":"https:\/\/www.lzych.pl\/en\/wp-json\/wp\/v2\/posts\/1361\/revisions\/1616"}],"wp:attachment":[{"href":"https:\/\/www.lzych.pl\/en\/wp-json\/wp\/v2\/media?parent=1361"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.lzych.pl\/en\/wp-json\/wp\/v2\/categories?post=1361"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.lzych.pl\/en\/wp-json\/wp\/v2\/tags?post=1361"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}