{"id":158,"date":"2020-09-26T12:35:40","date_gmt":"2020-09-26T12:35:40","guid":{"rendered":"https:\/\/dft.wiki\/?p=158"},"modified":"2021-06-04T00:29:53","modified_gmt":"2021-06-04T00:29:53","slug":"introduction-to-python","status":"publish","type":"post","link":"https:\/\/dft.wiki\/?p=158","title":{"rendered":"Introduction to Python"},"content":{"rendered":"<p>Python is just one more programming language. So, what is in it that everyone is talking about?<br \/>\nThat is a good question and you will answer by yourself, BUT the important is to surf this wave and don&#8217;t be left behind.<\/p>\n<p><strong>How to start?<\/strong><\/p>\n<p>Python is free. Which means you will not spend one cent to start creating.<br \/>\nPycharm is the name of the most popular tool for Python. You can get the Community version for free here -&gt; [<a href=\"https:\/\/www.jetbrains.com\/pycharm\/\">https:\/\/www.jetbrains.com\/pycharm\/<\/a>].<\/p>\n<p>The first step, in my opinion, is to watch this cool video that will take you from point Zero to an intermediate level of comprehension of the language.<br \/>\nBy Mike Dane -&gt; [<a href=\"https:\/\/www.youtube.com\/watch?v=rfscVS0vtbw\">https:\/\/www.youtube.com\/watch?v=rfscVS0vtbw<\/a>]<\/p>\n<p>You can also compile your Python program in Linux to run on any Windows computer as .exe:<\/p>\n<pre>pip install auto-py-to-exe\r\nauto-py-to-exe<\/pre>\n<p>Then you can start writing simple programs like the following:<\/p>\n<p><strong>Simple Calculator<\/strong>:<\/p>\n<pre>print(\"\\nExample: 4.5*9 or 35\/5 or 800-123\")\r\nformula = input(\"Type the math formula: \")\r\ni = 0\r\nj = 0\r\nvalue_c = \"\"\r\nvalue_d = \"\"\r\nvalue_e = \"\"\r\nlength = len(formula)\r\nwhile i &lt; length:\r\nif formula[i] == \"+\" or formula[i] == \"-\" or formula[i] == \"*\" or formula[i] == \"\/\":\r\nvalue_d = formula[i]\r\nj = 1\r\nelif j == 0:\r\nvalue_c = value_c + formula[i]\r\nelse:\r\nvalue_e = value_e + formula[i]\r\ni += 1\r\nvalue_c = float(value_c)\r\nvalue_e = float(value_e)\r\nif value_d == '+':\r\nprint(str(value_c) + \" + \" + str(value_e) + \" = \" + str(round(value_c + value_e, 12)))\r\nif value_d == '-':\r\nprint(str(value_c) + \" - \" + str(value_e) + \" = \" + str(round(value_c - value_e, 12)))\r\nif value_d == '*':\r\nprint(str(value_c) + \" * \" + str(value_e) + \" = \" + str(round(value_c * value_e, 12)))\r\nif value_d == '\/' and value_e != 0:\r\nprint(str(value_c) + \" \/ \" + str(value_e) + \" = \" + str(round(value_c \/ value_e, 12)))\r\nif value_d == '\/' and value_e == 0:\r\nprint(str(value_c) + \" \/ \" + str(value_e) + \" = \" + \"undefined\")<\/pre>\n<p>Just copy, paste and run this program code. See the output bellow:<\/p>\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" class=\"wp-image-117 aligncenter\" src=\"https:\/\/dft.wiki\/wp-content\/uploads\/sites\/15\/2020\/09\/image-1-2.png\" alt=\"\" \/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>Python is just one more programming language. So, what is in it that everyone is [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-158","post","type-post","status-publish","format-standard","hentry","category-programming"],"_links":{"self":[{"href":"https:\/\/dft.wiki\/index.php?rest_route=\/wp\/v2\/posts\/158","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dft.wiki\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dft.wiki\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dft.wiki\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dft.wiki\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=158"}],"version-history":[{"count":8,"href":"https:\/\/dft.wiki\/index.php?rest_route=\/wp\/v2\/posts\/158\/revisions"}],"predecessor-version":[{"id":2182,"href":"https:\/\/dft.wiki\/index.php?rest_route=\/wp\/v2\/posts\/158\/revisions\/2182"}],"wp:attachment":[{"href":"https:\/\/dft.wiki\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=158"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dft.wiki\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=158"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dft.wiki\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=158"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}