{"id":60,"date":"2021-05-03T17:38:33","date_gmt":"2021-05-03T17:38:33","guid":{"rendered":"http:\/\/juthon.com\/?p=60"},"modified":"2021-11-30T17:31:04","modified_gmt":"2021-11-30T17:31:04","slug":"odcinek-1-czy-warto-nauczyc-sie-kodowac-w-pythonie","status":"publish","type":"post","link":"http:\/\/juthon.com\/index.php\/2021\/05\/03\/odcinek-1-czy-warto-nauczyc-sie-kodowac-w-pythonie\/","title":{"rendered":"Passage 1: is it worth learning to code in Python"},"content":{"rendered":"\n<p>The answer is unequivocal. Really worth. There are many benefits to learning programming. It develops logical thinking. It gives skills and advantages that are useful to jobseekers. It allows you to indepen\u00addently build applications that can be used in everyday life. At the same time, it is a real fun and gives a lot of satisfaction.<\/p>\n\n\n\n<p>We hope that the series of articles that we are starting, will encourage you to learn programming. We&nbsp;chose Python as the language to learn programming for a reason.<\/p>\n\n\n\n<p>On internet portals we can read about this language:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" width=\"505\" height=\"391\" src=\"http:\/\/juthon.com\/wp-content\/uploads\/2021\/05\/Pass_01_Tab_01-eng.jpg\" alt class=\"wp-image-188\" srcset=\"http:\/\/juthon.com\/wp-content\/uploads\/2021\/05\/Pass_01_Tab_01-eng.jpg 505w, http:\/\/juthon.com\/wp-content\/uploads\/2021\/05\/Pass_01_Tab_01-eng-300x232.jpg 300w\" sizes=\"(max-width: 505px) 100vw, 505px\"><\/figure>\n\n\n\n<p><a href=\"#Odcinek-1\" data-type=\"internal\" data-id=\"#Odcinek-1\">Jump to Polish version<\/a><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" width=\"523\" height=\"515\" src=\"http:\/\/juthon.com\/wp-content\/uploads\/2021\/05\/Guido.png\" alt class=\"wp-image-64\" srcset=\"http:\/\/juthon.com\/wp-content\/uploads\/2021\/05\/Guido.png 523w, http:\/\/juthon.com\/wp-content\/uploads\/2021\/05\/Guido-300x295.png 300w\" sizes=\"(max-width: 523px) 100vw, 523px\"><\/figure>\n\n\n\n<p>One of the reasons for Python's success is its simplicity. Python is easy to learn, with an intuitive syntax. Its syntax is similar to that of an ordinary human language. Thanks to this, its keywords are understandable to any novice programmer. Python code is easy to write and execute much faster than any other programming language. You do not believe? Look at the code written in Java (the code opens the file and writes in the following data: name and phone number):<\/p>\n\n\n<p class=\"fonts-plugin-block \" style=\"font-family: consolas;font-weight: normal;font-size: 15px\">import java.io.BufferedWriter;<br>import java.io.File;<br>import java.io.FileWriter;<br>import java.io.IOException;<br>import java.util.Scanner;<br><br>public class phonebook {<br>public static void main(String[] args) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; String name, phno;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Scanner scanner = new Scanner (System.in);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.out.print(\"Please enter name\");&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; name = scanner.next(); \/\/ Get what the user types.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.out.print(\"Please enter phone number\");&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; phno = scanner.next();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; try {<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; File file = new File(\".\/contacts.csv\");<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (!file.exists()) { \/\/ if file doesnt exist, then create it<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; file.createNewFile();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FileWriter fw = new FileWriter(file.getAbsoluteFile(), true);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; BufferedWriter bw = new BufferedWriter(fw);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; bw.write(name + \",\" + phno + \"\\n\");<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; bw.close();<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } catch (IOException e) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; e.printStackTrace();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>}<br><\/p>\n\n\n<p>Oh, a solid piece of code \u2026 And those strange parentheses \u2026 You can get nystagmus.<\/p>\n\n\n\n<p>The same Python commands are only five short lines of&nbsp;code:<\/p>\n\n\n<p class=\"fonts-plugin-block \" style=\"font-family: consolas;font-weight: normal;font-size: 15px\">file = open(\"contacts.csv\", \"a\")<br>name = input(\"Please enter name.\")<br>phno = input(\"Please enter phone number.\")<br>file.write(name + \",\" + phno + \"\\n\")<br>file.close()<br><\/p>\n\n\n<p>Impressive, isn't&nbsp;it?<\/p>\n\n\n<h3 class=\"fonts-plugin-block \" style=\"font-weight: normal;font-size: 40px\">A bit of statistics<\/h3>\n\n\n<p>According to current statistics, Python is the third most popular language in the world, used by qualified programmers and engineers (TIOBE, 2020).<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" width=\"1024\" height=\"601\" src=\"http:\/\/juthon.com\/wp-content\/uploads\/2021\/05\/Chart-one-1024x601.png\" alt class=\"wp-image-61\" srcset=\"http:\/\/juthon.com\/wp-content\/uploads\/2021\/05\/Chart-one-1024x601.png 1024w, http:\/\/juthon.com\/wp-content\/uploads\/2021\/05\/Chart-one-300x176.png 300w, http:\/\/juthon.com\/wp-content\/uploads\/2021\/05\/Chart-one-768x451.png 768w, http:\/\/juthon.com\/wp-content\/uploads\/2021\/05\/Chart-one.png 1228w\" sizes=\"(max-width: 1024px) 100vw, 1024px\"><\/figure>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/p>\n\n\n\n<p>On the other hand, in the statistics showing which language is the most popular among all programmers (the language most searched for on the Internet), Python outclasses its rivals with a 30% result (the second on the list Java is twice less popular) (PYPL, 2020).<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" width=\"1024\" height=\"634\" src=\"http:\/\/juthon.com\/wp-content\/uploads\/2021\/05\/Chart-two-1024x634.png\" alt class=\"wp-image-62\" srcset=\"http:\/\/juthon.com\/wp-content\/uploads\/2021\/05\/Chart-two-1024x634.png 1024w, http:\/\/juthon.com\/wp-content\/uploads\/2021\/05\/Chart-two-300x186.png 300w, http:\/\/juthon.com\/wp-content\/uploads\/2021\/05\/Chart-two-768x476.png 768w, http:\/\/juthon.com\/wp-content\/uploads\/2021\/05\/Chart-two.png 1161w\" sizes=\"(max-width: 1024px) 100vw, 1024px\"><\/figure>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/p>\n\n\n\n<p>Python is a flexible tool. It allows you to program both in the traditional (procedural) programming style and in the object-oriented style.<\/p>\n\n\n<h3 class=\"fonts-plugin-block \" style=\"font-weight: normal;font-size: 40px\">Installing Python on your computer<\/h3>\n\n\n<p>Python is completely free (so-called open-source software). To install Python on your computer, just go to www.python.org, select the Downloads tab and click the \"Download Python 3.9.2\" button.<\/p>\n\n\n\n<p><em>Caution.<\/em><em> <\/em><em>At the time of writing this article, the latest version of Python is 3.9.2.<\/em><em> <\/em><em>When you attempt the installation, a newer version may be available.<\/em><em> <\/em><em>Apart from particularly justified cases, always download the latest available version.<\/em><\/p>\n\n\n\n<p>Installing Python is very easy. If you are concerned that you will need detailed guidance, use the numerous guides available on the web, e.g. <a href=\"https:\/\/datatofish.com\/install-python\/\">https:\/\/datatofish.com\/install-python\/<\/a><\/p>\n\n\n\n<p>After installing Python, it is a good idea to recognize the path to the python.exe file. It may come in handy in the future. Depending on the version of Python and the version of the operating system on your computer, this file may be in different directories (folders), e.g. <code>C:\\Users\\MyUserName\\AppData\\Local\\Programs\\Python\\<\/code><\/p>\n\n\n\n<p>During installation, we recommend that you tick the \"Add Python 3.9 to PATH\"&nbsp;box.<\/p>\n\n\n\n<p>By adding \"Python to the path\", you will be able to access the program (ie python.exe) by typing in windows command prompt the python keyword (you won\u2019t need to specify the full path to the program).<\/p>\n\n\n\n<p>In order to use Python, we will need \u2014 additionally \u2014 a simple text editor, eg Notepad, available as standard in Windows. How to use it for coding \u2014 we will write about it in the next&nbsp;post.<\/p>\n\n\n<p class=\"fonts-plugin-block \" style=\"font-weight: normal\">When we start coding, we will save the results of our work in Python files (files with the * .py extension). It is worth creating a separate folder to which we will have easy access and where we will save newly created Python files.<\/p>\n\n<h3 class=\"fonts-plugin-block \" style=\"font-weight: normal;font-size: 40px;line-height: 2\">IDLE<\/h3>\n\n\n<p>When you install Python, along with a language interpreter (i.e. a command execution machine), a graphical user interface called IDLE will be installed on your computer. It allows you to work with Python in the way we are used to working with applications nowadays, i.e. using windows and drop-down menus, and therefore using the mouse, not just the keyboard<a href=\"#_ftn1\">[1]<\/a>. Both Python itself and IDLE will appear in the \"Windows\" menu once installed \u2014 just waiting for you to start working with&nbsp;them.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" width=\"1024\" height=\"710\" src=\"http:\/\/juthon.com\/wp-content\/uploads\/2021\/05\/Idle-in-menu-1024x710.png\" alt class=\"wp-image-65\" srcset=\"http:\/\/juthon.com\/wp-content\/uploads\/2021\/05\/Idle-in-menu-1024x710.png 1024w, http:\/\/juthon.com\/wp-content\/uploads\/2021\/05\/Idle-in-menu-300x208.png 300w, http:\/\/juthon.com\/wp-content\/uploads\/2021\/05\/Idle-in-menu-768x533.png 768w, http:\/\/juthon.com\/wp-content\/uploads\/2021\/05\/Idle-in-menu.png 1034w\" sizes=\"(max-width: 1024px) 100vw, 1024px\"><\/figure>\n\n\n\n<p>Now it's time to take a look at what IDLE looks like. Hover the mouse over and click. A window like this will&nbsp;open:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" width=\"1024\" height=\"587\" src=\"http:\/\/juthon.com\/wp-content\/uploads\/2021\/05\/Drop-down-menu-1024x587.png\" alt class=\"wp-image-63\" srcset=\"http:\/\/juthon.com\/wp-content\/uploads\/2021\/05\/Drop-down-menu-1024x587.png 1024w, http:\/\/juthon.com\/wp-content\/uploads\/2021\/05\/Drop-down-menu-300x172.png 300w, http:\/\/juthon.com\/wp-content\/uploads\/2021\/05\/Drop-down-menu-768x440.png 768w, http:\/\/juthon.com\/wp-content\/uploads\/2021\/05\/Drop-down-menu.png 1094w\" sizes=\"(max-width: 1024px) 100vw, 1024px\"><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>The main window of IDLE is called the \"shell\". In addition to the nice use of drop-down menus, you can type direct commands to the Python interpreter in the shell. What does it mean? Any command you type will be executed immediately (as soon as we enter in a command, Python will execute it and display its result).<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" width=\"1024\" height=\"540\" src=\"http:\/\/juthon.com\/wp-content\/uploads\/2021\/05\/Operation-in-IDLE-1024x540.png\" alt class=\"wp-image-66\" srcset=\"http:\/\/juthon.com\/wp-content\/uploads\/2021\/05\/Operation-in-IDLE-1024x540.png 1024w, http:\/\/juthon.com\/wp-content\/uploads\/2021\/05\/Operation-in-IDLE-300x158.png 300w, http:\/\/juthon.com\/wp-content\/uploads\/2021\/05\/Operation-in-IDLE-768x405.png 768w, http:\/\/juthon.com\/wp-content\/uploads\/2021\/05\/Operation-in-IDLE.png 1068w\" sizes=\"(max-width: 1024px) 100vw, 1024px\"><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>We realize that at the beginning of learning, the sentences or remarks characterizing the shell \u2014 which you have just read \u2014 may sound a bit enigmatic. Don't worry about this. We assure you that you will quickly become friends with the shell \u2014 more in \"this topic\" in the next passage.<\/p>\n\n\n<h3 class=\"fonts-plugin-block \" style=\"font-weight: normal;font-size: 40px\">Summary<\/h3>\n\n\n<p>In the first episode of our series, we tried to present some introductory information about Python. And&nbsp;encourage you to learn this excellent programming language. If you've downloaded Python and installed it on your computer, we encourage you to put Python and IDLE shortcuts in the Windows start menu. Once that's done, let's begin: click IDLE to run it. Check if (as we have shown) it is possible to perform a simple math operation in&nbsp;shell.<\/p>\n\n\n\n<p>If everything is fine, we are ready to start coding. See the next&nbsp;posts&nbsp;\u2026<\/p>\n\n\n\n<hr class=\"wp-block-separator\">\n\n\n\n<p><a href=\"#_ftnref1\">[1]<\/a> In addition, IDLE provides greater comfort of work by coloring fragments of code and displaying information about errors<\/p>\n\n\n\n<p class=\"has-text-color has-small-font-size\" style=\"color:#dfe2e3\">a<\/p>\n\n\n\n<p class=\"has-text-color has-small-font-size\" style=\"color:#e9edef\">a<\/p>\n\n\n\n<p class=\"has-text-color has-small-font-size\" style=\"color:#dfe5e8\">a<\/p>\n\n\n\n<p id=\"Odcinek-1\">Odcinek\u20111<\/p>\n\n\n<h2 class=\"fonts-plugin-block \" style=\"font-weight: normal;font-size: 50px\">Odcinek 1: Czy warto nauczy\u0107 si\u0119 kodowa\u0107 w&nbsp;Pythonie<\/h2>\n\n\n<p><\/p>\n\n\n\n<p>Odpowied\u017a jest jednoznaczna. Naprawd\u0119 warto. Nauka ta&nbsp;przynosi wiele korzy\u015bci. Rozwija logiczne my\u015blenie.&nbsp; Daje umie\u00adj\u0119tno\u015bci i przewag\u0119, kt\u00f3re przydaj\u0105 si\u0119 osobom poszukuj\u0105cym pracy. Pozwala samodzielnie budowa\u0107 aplikacje, kt\u00f3re mog\u0105 by\u0107 wykorzystane w codziennym \u017cyciu.<\/p>\n\n\n\n<p>A przy okazji jest prawdziw\u0105 frajd\u0105 i daje mn\u00f3stwo zadowolenia.<\/p>\n\n\n\n<p>Wyra\u017camy nadziej\u0119, \u017ce cykl artyku\u0142\u00f3w, kt\u00f3ry rozpoczynamy, zach\u0119ci Ci\u0119 do nauki programowania. Nie bez powodu wybrali\u015bmy Pythona \u2013 jako j\u0119zyk do nauki programowania.<\/p>\n\n\n\n<p>Na internetowych portalach mo\u017cemy przeczyta\u0107 o tym j\u0119zyku:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" width=\"491\" height=\"398\" src=\"http:\/\/juthon.com\/wp-content\/uploads\/2021\/05\/Pass_01_Tab_01-pol.jpg\" alt class=\"wp-image-189\" srcset=\"http:\/\/juthon.com\/wp-content\/uploads\/2021\/05\/Pass_01_Tab_01-pol.jpg 491w, http:\/\/juthon.com\/wp-content\/uploads\/2021\/05\/Pass_01_Tab_01-pol-300x243.jpg 300w\" sizes=\"(max-width: 491px) 100vw, 491px\"><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" width=\"523\" height=\"515\" src=\"http:\/\/juthon.com\/wp-content\/uploads\/2021\/05\/Guido.png\" alt class=\"wp-image-64\" srcset=\"http:\/\/juthon.com\/wp-content\/uploads\/2021\/05\/Guido.png 523w, http:\/\/juthon.com\/wp-content\/uploads\/2021\/05\/Guido-300x295.png 300w\" sizes=\"(max-width: 523px) 100vw, 523px\"><\/figure>\n\n\n\n<p>Jednym z powod\u00f3w sukcesu Pythona jest jego prostota. Python jest \u0142atwy w nauce, posiada wr\u0119cz intuicyjn\u0105 sk\u0142adni\u0119. Jego sk\u0142adnia przypomina sk\u0142adni\u0119 zwyk\u0142ego j\u0119zyka jakim porozumiewaj\u0105 si\u0119 ludzie (angielskiego niestety, nie polskiego). Dzi\u0119ki temu jego s\u0142owa kluczowe s\u0105 zrozumia\u0142e dla ka\u017cdego pocz\u0105tkuj\u0105cego programisty.<\/p>\n\n\n\n<p>Kod w Pythonie mo\u017cna \u0142atwo pisa\u0107 i wykonywa\u0107 znacznie szybciej ni\u017c w innych j\u0119zykach progra\u00admowania. Nie wierzysz? Sp\u00f3jrz na kod zapisany w Javie (kod otwiera plik i wpisuje do&nbsp;niego dane: nazwisko i numer telefonu):<\/p>\n\n\n<p class=\"fonts-plugin-block \" style=\"font-family: consolas;font-weight: normal;font-size: 15px\">import java.io.BufferedWriter;<br>import java.io.File;<br>import java.io.FileWriter;<br>import java.io.IOException;<br>import java.util.Scanner;<br><br>public class phonebook {<br>public static void main(String[] args) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; String name, phno;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Scanner scanner = new Scanner (System.in);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.out.print(\"Please enter name\");&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; name = scanner.next(); \/\/ Get what the user types.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.out.print(\"Please enter phone number\");&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; phno = scanner.next();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; try {<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; File file = new File(\".\/contacts.csv\");<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (!file.exists()) { \/\/ if file doesnt exist, then create it<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; file.createNewFile();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FileWriter fw = new FileWriter(file.getAbsoluteFile(), true);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; BufferedWriter bw = new BufferedWriter(fw);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; bw.write(name + \",\" + phno + \"\\n\");<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; bw.close();<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } catch (IOException e) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; e.printStackTrace();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>}<\/p>\n\n\n<p>Oj, solidny kawa\u0142 kodu\u2026 I te dziwne nawiasy\u2026 Mo\u017cna dosta\u0107 oczopl\u0105su.<\/p>\n\n\n\n<p>Te same polecenia w Pythonie, to ledwie pi\u0119\u0107 kr\u00f3tkich linijek kodu:<\/p>\n\n\n<p class=\"fonts-plugin-block \" style=\"font-family: consolas;font-weight: normal;font-size: 15px\">file = open(\"contacts.csv\", \"a\")<br>name = input(\"Please enter name.\")<br>phno = input(\"Please enter phone number.\")<br>file.write(name + \",\" + phno + \"\\n\")<br>file.close()<br><\/p>\n\n\n<p>Imponuj\u0105ce, prawda?<\/p>\n\n\n<h3 class=\"fonts-plugin-block \" style=\"font-weight: normal\">Odrobin\u0119 statystyk<\/h3>\n\n\n<p>Wg obecnych statystyk, Python jest trzecim najpopularniejszym j\u0119zykiem na \u015bwiecie, u\u017cywanym przez wykwalifikowanych programist\u00f3w i in\u017cynier\u00f3w (TIOBE, 2020).<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" width=\"1024\" height=\"601\" src=\"http:\/\/juthon.com\/wp-content\/uploads\/2021\/05\/Chart-one-1024x601.png\" alt class=\"wp-image-61\" srcset=\"http:\/\/juthon.com\/wp-content\/uploads\/2021\/05\/Chart-one-1024x601.png 1024w, http:\/\/juthon.com\/wp-content\/uploads\/2021\/05\/Chart-one-300x176.png 300w, http:\/\/juthon.com\/wp-content\/uploads\/2021\/05\/Chart-one-768x451.png 768w, http:\/\/juthon.com\/wp-content\/uploads\/2021\/05\/Chart-one.png 1228w\" sizes=\"(max-width: 1024px) 100vw, 1024px\"><figcaption>\u0179r\u00f3d\u0142o: darly.solutions<\/figcaption><\/figure>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/p>\n\n\n\n<p>Z kolei w statystykach pokazuj\u0105cych, kt\u00f3ry j\u0119zyk jest najpopularniejszy w\u015br\u00f3d og\u00f3\u0142u programist\u00f3w (j\u0119zyk najcz\u0119\u015bciej wyszukiwany w internecie), Python deklasuje rywali z 30% wynikiem (druga w kolejno\u015bci Java cieszy si\u0119 dwa razy mniejszym zainteresowaniem) (PYPL, 2020).<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" width=\"1024\" height=\"634\" src=\"http:\/\/juthon.com\/wp-content\/uploads\/2021\/05\/Chart-two-1024x634.png\" alt class=\"wp-image-62\" srcset=\"http:\/\/juthon.com\/wp-content\/uploads\/2021\/05\/Chart-two-1024x634.png 1024w, http:\/\/juthon.com\/wp-content\/uploads\/2021\/05\/Chart-two-300x186.png 300w, http:\/\/juthon.com\/wp-content\/uploads\/2021\/05\/Chart-two-768x476.png 768w, http:\/\/juthon.com\/wp-content\/uploads\/2021\/05\/Chart-two.png 1161w\" sizes=\"(max-width: 1024px) 100vw, 1024px\"><figcaption>\u0179r\u00f3d\u0142o: darly.solutions<\/figcaption><\/figure>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/p>\n\n\n\n<p>Python jest elastycznym narz\u0119dziem. Pozwala programowa\u0107 zar\u00f3wno w tradycyjnym (proceduralnym) stylu programowania, jak i w stylu zorientowanym obiektowo.<\/p>\n\n\n<h3 class=\"fonts-plugin-block \" style=\"font-weight: normal\">Instalacja Pythona na twoim komputerze<\/h3>\n\n\n<p>Python jest ca\u0142kowicie darmowy (tzw. open-source software).<\/p>\n\n\n\n<p>Aby zainstalowa\u0107 j\u0119zyk Python na swoim komputerze, wystarczy wej\u015b\u0107 na stron\u0119 www.python.org, wybra\u0107 zak\u0142adk\u0119 Downloads i klikn\u0105\u0107 przycisk \"Download Python 3.9.2\".<\/p>\n\n\n\n<p><em>Uwaga. W momencie gdy piszemy ten artyku\u0142, najnowsza wersja Pythona to w\u0142a\u015bnie 3.9.2. W&nbsp;chwili, gdy Ty po\u00addejmiesz pr\u00f3b\u0119 instalacji, dost\u0119pna mo\u017ce by\u0107 ju\u017c nowsza wersja. Poza szczeg\u00f3lnie uzasadnionymi przypadkami, pobieraj zawsze najnowsz\u0105 dost\u0119pn\u0105 wersj\u0119.<\/em><\/p>\n\n\n\n<p>Instalacja Pythona jest banalnie prosta. Je\u015bli obawiasz si\u0119, \u017ce potrzebowa\u0142 b\u0119dziesz szczeg\u00f3\u0142owych wskaz\u00f3wek, skorzystaj z licznych poradnik\u00f3w dost\u0119pnych w sieci, np. <a href=\"https:\/\/datatofish.com\/install-python\/\">https:\/\/datatofish.com\/install-python\/<\/a><\/p>\n\n\n\n<p>Po instalacji Pythona dobrze jest ustali\u0107 \u015bcie\u017ck\u0119 dost\u0119pu do pliku python.exe. Mo\u017ce si\u0119 przyda\u0107 w&nbsp;przysz\u0142o\u015bci. Zale\u017cnie od wersji Pythona i wersji systemu operacyjnego na twoim komputerze, plik&nbsp;ten mo\u017ce si\u0119 znale\u017a\u0107 w r\u00f3\u017cnych katalogach (folderach), np.<code> <\/code><code>C:\\Users\\MyUserName\\AppData\\Local\\Programs\\Python\\<\/code><\/p>\n\n\n\n<p>Podczas instalacji, doradzamy zaznaczenie okienka &nbsp;\"Add Python 3.9 to&nbsp;PATH\".<\/p>\n\n\n\n<p>Dodaj\u0105c \"Pythona do \u015bcie\u017cki\", b\u0119dziesz m\u00f3g\u0142 uzyska\u0107 dost\u0119p do programu (czyli python.exe), wpisuj\u0105c w wierszu polece\u0144 Windowsa (command prompt) s\u0142owo kluczowe python (nie musisz okre\u015bla\u0107 pe\u0142nej \u015bcie\u017cki do programu).<\/p>\n\n\n\n<p>Aby korzysta\u0107 z Pythona, przyda si\u0119 nam \u2013 dodatkowo \u2013 prosty edytor tekstu, np. Notatnik (Notepad), standardowo dost\u0119pny w systemie Windows. Jak z niego korzysta\u0107 \u2013 o tym napiszemy w kolejnym po\u015bcie.<\/p>\n\n\n\n<p>Gdy ju\u017c zaczniemy kodowa\u0107, efekty naszej pracy zapisywa\u0107 b\u0119dziemy w plikach Pythona (plikach z&nbsp;rozszerzeniem *.py). Warto za\u0142o\u017cy\u0107 osobny folder, do kt\u00f3rego b\u0119dziemy mieli \u0142atwy dost\u0119p, i w kt\u00f3rym&nbsp;zapisywa\u0107 b\u0119dziemy nowo tworzone pliki Pythona.<\/p>\n\n\n<h3 class=\"fonts-plugin-block \" style=\"font-weight: normal\">IDLE<\/h3>\n\n\n<p>Gdy zainstalujesz Pythona, wraz z <strong><em>interpreterem<\/em><\/strong> j\u0119zyka (czyli maszyn\u0105 do wykonywania polece\u0144), na twoim komputerze zostanie zainstalowane \u015brodowisko graficzne nazywane IDLE. Pozwala ono pracowa\u0107 z Pythonem w&nbsp;taki spos\u00f3b, jak jeste\u015bmy w dzisiejszych czasach przyzwyczajeni pracowa\u0107 z aplikacjami, czyli przy u\u017cyciu okien i rozwijanych menu, a wi\u0119c u\u017cywaj\u0105c tak\u017ce myszy, a nie tylko klawiatury<a href=\"#_ftn1\">[1]<\/a>. Zar\u00f3wno sam Python, jak i IDLE po zainstalowaniu pojawi\u0105 si\u0119 w \"windowsowym\" menu \u2013 i tylko czekaj\u0105, aby\u015b zacz\u0105\u0142 z nimi pracowa\u0107.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" width=\"1024\" height=\"710\" src=\"http:\/\/juthon.com\/wp-content\/uploads\/2021\/05\/Idle-in-menu-1024x710.png\" alt class=\"wp-image-65\" srcset=\"http:\/\/juthon.com\/wp-content\/uploads\/2021\/05\/Idle-in-menu-1024x710.png 1024w, http:\/\/juthon.com\/wp-content\/uploads\/2021\/05\/Idle-in-menu-300x208.png 300w, http:\/\/juthon.com\/wp-content\/uploads\/2021\/05\/Idle-in-menu-768x533.png 768w, http:\/\/juthon.com\/wp-content\/uploads\/2021\/05\/Idle-in-menu.png 1034w\" sizes=\"(max-width: 1024px) 100vw, 1024px\"><\/figure>\n\n\n\n<p>Teraz czas przyjrze\u0107 si\u0119, jak wygl\u0105da IDLE. Najed\u017a mysz\u0105 i kliknij.<\/p>\n\n\n\n<p>Otworzy si\u0119 takie okienko:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" width=\"1024\" height=\"587\" src=\"http:\/\/juthon.com\/wp-content\/uploads\/2021\/05\/Drop-down-menu-1024x587.png\" alt class=\"wp-image-63\" srcset=\"http:\/\/juthon.com\/wp-content\/uploads\/2021\/05\/Drop-down-menu-1024x587.png 1024w, http:\/\/juthon.com\/wp-content\/uploads\/2021\/05\/Drop-down-menu-300x172.png 300w, http:\/\/juthon.com\/wp-content\/uploads\/2021\/05\/Drop-down-menu-768x440.png 768w, http:\/\/juthon.com\/wp-content\/uploads\/2021\/05\/Drop-down-menu.png 1094w\" sizes=\"(max-width: 1024px) 100vw, 1024px\"><figcaption>IDLE Pythona. Ma ono posta\u0107 okna z rozwijanymi menu (m.in. File, Edit, Options).<\/figcaption><\/figure>\n\n\n\n<p>&nbsp;&nbsp; <\/p>\n\n\n\n<p>G\u0142\u00f3wne okno IDLA nazywa si\u0119 \"pow\u0142ok\u0105\" (shell). Opr\u00f3cz mi\u0142ej mo\u017cliwo\u015bci korzystania z rozwi\u00adjanych menu, w pow\u0142oce mo\u017cna wpisywa\u0107 bezpo\u015brednie polecenia dla interpretera j\u0119zyka Python. Co to znaczy? Ka\u017cde wpisane polecenie zostanie natychmiast wykonane&nbsp;<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" width=\"1024\" height=\"540\" src=\"http:\/\/juthon.com\/wp-content\/uploads\/2021\/05\/Operation-in-IDLE-1024x540.png\" alt class=\"wp-image-66\" srcset=\"http:\/\/juthon.com\/wp-content\/uploads\/2021\/05\/Operation-in-IDLE-1024x540.png 1024w, http:\/\/juthon.com\/wp-content\/uploads\/2021\/05\/Operation-in-IDLE-300x158.png 300w, http:\/\/juthon.com\/wp-content\/uploads\/2021\/05\/Operation-in-IDLE-768x405.png 768w, http:\/\/juthon.com\/wp-content\/uploads\/2021\/05\/Operation-in-IDLE.png 1068w\" sizes=\"(max-width: 1024px) 100vw, 1024px\"><figcaption>Przyk\u0142ad dzia\u0142ania w \"pow\u0142oce\" (shellu). Wpisali\u015bmy polecenie 2+3. Po naci\u015bni\u0119ciu Enter natychmiast pojawia si\u0119 wynik: 5<\/figcaption><\/figure>\n\n\n\n<p>Zdajemy sobie spraw\u0119, \u017ce na pocz\u0105tku nauki, zdania czy uwagi charakteryzuj\u0105ce pow\u0142ok\u0119 \u2013 kt\u00f3re przed chwil\u0105 przeczyta\u0142e\u015b \u2013 mog\u0105 brzmie\u0107 nieco enigmatycznie. Nie nale\u017cy si\u0119 tym przejmowa\u0107. Zapewniamy, \u017ce szybko zaprzyja\u017anisz si\u0119 z shellem&nbsp; \u2013 wi\u0119cej w \"tym temacie\" ju\u017c w kolejnym odcinku.<\/p>\n\n\n<p class=\"fonts-plugin-block \" style=\"font-weight: normal\"><\/p>\n\n<h3 class=\"fonts-plugin-block \" style=\"font-weight: normal;font-size: 40px\">Podsumowanie<\/h3>\n\n<p class=\"fonts-plugin-block \" style=\"font-weight: normal\">W pierwszym odcinku naszego cyklu starali\u015bmy si\u0119 zaprezentowa\u0107 wst\u0119pne informacje dotycz\u0105ce Pythona. I zach\u0119ci\u0107 do nauki tego znakomitego j\u0119zyka programowania.<\/p>\n\n\n<p>Je\u015bli pobra\u0142e\u015b Pythona i zainstalowa\u0142e\u015b go na swoim komputerze, zach\u0119camy do umieszczenia skr\u00f3t\u00f3w do Pythona i do IDLA w obszarze startowym Windows. Gdy to ju\u017c zrobisz, uruchom IDLA. Sprawd\u017a czy (tak jak pokazali\u015bmy) da si\u0119 w nim wykona\u0107 proste dzia\u0142anie matematyczne.<\/p>\n\n\n\n<p>Je\u015bli wszystko gra, czas zacz\u0105\u0107 kodowa\u0107. Zapraszamy do kolejnych post\u00f3w\u2026<\/p>\n\n\n\n<hr class=\"wp-block-separator\">\n\n\n\n<p><a href=\"#_ftnref1\">[1]<\/a> Ponadto IDLE zapewnia wy\u017cszy komfort pracy, kolryzuj\u0105c fragmenty kodu i wy\u015bwietlaj\u0105c informacje o b\u0142\u0119dach<\/p>\n\n\n<p class=\"fonts-plugin-block \" style=\"font-weight: normal\"><\/p>","protected":false},"excerpt":{"rendered":"<p>The answer is unequivocal. Really worth. There are many benefits to learning programming. It develops&nbsp;[\u2026]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"wp_typography_post_enhancements_disabled":false},"categories":[1],"tags":[],"_links":{"self":[{"href":"http:\/\/juthon.com\/index.php\/wp-json\/wp\/v2\/posts\/60"}],"collection":[{"href":"http:\/\/juthon.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/juthon.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/juthon.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/juthon.com\/index.php\/wp-json\/wp\/v2\/comments?post=60"}],"version-history":[{"count":8,"href":"http:\/\/juthon.com\/index.php\/wp-json\/wp\/v2\/posts\/60\/revisions"}],"predecessor-version":[{"id":190,"href":"http:\/\/juthon.com\/index.php\/wp-json\/wp\/v2\/posts\/60\/revisions\/190"}],"wp:attachment":[{"href":"http:\/\/juthon.com\/index.php\/wp-json\/wp\/v2\/media?parent=60"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/juthon.com\/index.php\/wp-json\/wp\/v2\/categories?post=60"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/juthon.com\/index.php\/wp-json\/wp\/v2\/tags?post=60"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}