{"id":1881,"date":"2021-08-05T08:04:44","date_gmt":"2021-08-05T08:04:44","guid":{"rendered":"https:\/\/methodologydesign.com\/?p=1881"},"modified":"2021-08-05T08:07:40","modified_gmt":"2021-08-05T08:07:40","slug":"1a-inside-the-mind-of-software-python-how-to-guide","status":"publish","type":"post","link":"https:\/\/www.methodologydesign.com\/index.php\/2021\/08\/05\/1a-inside-the-mind-of-software-python-how-to-guide\/","title":{"rendered":"1a. Inside the Mind of Software &#8211; Python How-To Guide"},"content":{"rendered":"<span class=\"span-reading-time rt-reading-time\" style=\"display: block;\"><span class=\"rt-label rt-prefix\">Reading Time: <\/span> <span class=\"rt-time\"> 7<\/span> <span class=\"rt-label rt-postfix\">minutes<\/span><\/span>\n<p>As a beginner, you will want to start out following these instructions:<\/p>\n\n\n\n<p>1. Using an online &#8220;Python in your browser&#8221; service such as PythonAnywhere in order to be able to run code interactively,\nwhich essentially means you can type and execute a single line of code, one after another, and therefore test your code\nas you go along.<\/p>\n\n\n\n<p>2. With Python running in your browser, begin to put Python code in a file, of which we will call a script. Then attempt\nto run that script.<\/p>\n\n\n\n<p>3. Proceed to install Python on your computer.<\/p>\n\n\n\n<p>4. IPython and Jupyter are good programs to consider for installing, which are interactive development environments or IDE&#8217;s\nthat can be used to run Python as well as other programming languages.<\/p>\n\n\n\n<p>We will provide you further details on how to achieve these instructions down below. If you have some advanced level of\nfamiliarity installing applications and whatnot on your computer, you can skip directly to instruction number 3. Otherwise,\nread from the beginning.<\/p>\n\n\n\n<p><b>INSTRUCTION 1: Python running in a browser tab, in an online interactive development environment.<\/b><\/p>\n\n\n\n<p>As was stated previously earlier in the article, there are several websites that allow you to run Python in your web browser.\nYou can run any of these that you please, but the detailed instructions will pertain to PythonAnywhere.<\/p>\n\n\n\n<p>First, go to Pythonanywhere.com and click the &#8220;Pricing and Sign Up&#8221; page on the top menu bar, in the upper right corner\nof the homepage. The free beginner account will be sufficient for our purposes. \n<\/p>\n\n\n\n<p>Second, once you create the account, there should be a sub-tab underneath with the name &#8220;Consoles&#8221;, which is where you can\nexecute Python commands. The other consoles enable you the ability to execute other types of commands.<\/p>\n\n\n\n<p>Third, where it says, &#8220;Start new console&#8221;, select Python 3.4, which will launch a fresh console running Python on version\n3, which is the current version. The result should be a black window with some harsh looking font of white letters against\nthe black backdrop. <\/p>\n\n\n\n<p>In the black window, you will notice it contains information regarding the Python interpreter as well as the operating\nsystem it&#8217;s being run on. The next line should contain something called a &#8220;prompt&#8221; which will provide you with an indication\nas to the state of readiness of the usability in terms of writing Python code there. You can type any of the examples\nthat we will provide you with and see the results for yourself, as the interpreter will interpret the code in these\nexamples and execute them accordingly.<\/p>\n\n\n\n<p>Fourth, you should click the &#8220;Dashboard&#8221; tab in the upper right menu, and you&#8217;ll see a new console has popped up under\nthe &#8220;Consoles&#8221; subtab. Then in order to return to your console, click on it&#8217;s name, it should say something like \n&#8220;Python 3.4 console 1724197&#8221;. These consoles can be kept active for as long as you desire, but if you wish to clean them\nup and delete them, you can press the &#8220;kill&#8221; button located beside them.<\/p>\n\n\n\n<p>Fifth, this step is more optional than mandatory but if you prefer, you can nominate this website as your &#8220;teacher&#8221; on\nPythonAnywhere. If you have any questions, you can always refer to the Python documentation or to the W3 Schools website\nfor more in depth tutorials and explanations. If you nominate this website, we will have access to the consoles and files\nyou create on PythonAnywhere, although it will NOT grant us access to your computer. If that is something you would\nconsider doing, navigate your cursor to the &#8220;Account&#8221; tab in the menu bar and then proceed to the &#8220;Teacher&#8221; subtab. <\/p>\n\n\n\n<p>\nEnter the username of this website, &#8220;MethodologyDesign&#8221;, in the text box, then click the check button. Our team should\nreceive an email that you&#8217;ve signed up.<\/p>\n\n\n\n<p>Sixth and final point, click on the &#8220;Dashboard&#8221; tab and proceed to choose an open console or make a new one, and return\nto trying different examples and codes you can find around the internet to see what they produce.<\/p>\n\n\n\n<p><b>INSTRUCTION 2: Running Python in your browser, using scripts.<\/b><\/p>\n\n\n\n<p>If you intend to run Python interactively, it can be a good learning experience for beginners. It can be a however, somewhat\nof a clunky experience, especially if you intend to write more than just a few lines of code. <\/p>\n\n\n\n<p>An intelligent way would be to make use of a file called a script in which the commands are already written down but\nare then fed into the interpreter in order to attempt to execute all or some of these commands. Here are some basic\ninstructions on how to carry out this task in PythonAnywhere:<\/p>\n\n\n\n<p>The first step is to click on the &#8220;Dashboard&#8221; tab and then proceed to click on the &#8220;Files&#8221; subtab. You should be able to\nsee a list of files that were created by the system. <\/p>\n\n\n\n<p>The second step is to navigate to the text box that says &#8220;Enter a new file name&#8221;, and then type a name like Myprogram.py.\nIt is customary in the Python language that files written in Python end with the extension .py. Click the &#8220;New&#8221; button,\nand there should be a prompt where you can write stuff. Let&#8217;s call the prompt a sort of editor. When you want to run\nyour code, click on the button with the three angle brackets, that look like this &#8211; &gt;&gt;&gt;. If it&#8217;s your first time doing\nthis, there&#8217;s a good chance your browser will ask you to allow popups, in which cash you should click yes.<\/p>\n\n\n\n<p>If your program executed successfully, you will get the result of your work in this new popup. Now you can edit and\nexecute the program as many times as you wish inside this popup.<\/p>\n\n\n\n<p>In the third step, when you are finished, close the window that gave you your output and proceed to return to the &#8220;Files&#8221;\ntab. The file that you created when you executed the script should now be in that list of files, automatically generated\nfor you. You can now proceed to use the buttons to either download, edit or delete the file.\n<\/p>\n\n\n\n<p>If you return to the &#8220;Console&#8221; subtab, there is a slight possibility that there might be a console for the file you just\nfinished editing. When you have completed the file to your satisfaction, you can kill the console but the file will remain\nthere for you to reopen again in a new console if you wish.<\/p>\n\n\n\n<p><b>INSTRUCTION 3: A computer based installation of Python.<\/b><\/p>\n\n\n\n<p>The highest recommended software distribution package for Python on the Windows, Linux and Mac operating systems is\nAnaconda. It also includes the most common Python modules that are used, and therefore you are most likely to use them\ndue to the nature of their utility. The upside to this distribution is that not only is it free, but it&#8217;s also an easy\ninstall that&#8217;s automated for you, requires no manual tasks and installs to your home directory, therefore there is no\nneed to manually grant it administrative privledges. \n<\/p>\n\n\n\n<p>First, start up your browser, any browser, whichever browser you use, and head on to the Anaconda download page on their\nwebsite. <\/p>\n\n\n\n<p>Second, in the upper right corner there should be a button that allows you to choose Python 3.4. Click that.<\/p>\n\n\n\n<p>Third, make sure you get the installer that is designed for your operating system, which will most likely be a 64 bit\noperating system unless you have a computer that is noticeably very old.<\/p>\n\n\n\n<p>Fourth, the software should download automatically. When it finishes downloading, you should proceed by opening it,\nunless it starts up by itself.<\/p>\n\n\n\n<p>Fifth, the setup wizard will then request input from you as to what options you want in your installation configuration.\nYou will most likely accept what&#8217;s considered default by the software and proceed that way. It is recommended that you\nallow the installer to determine your installation path as well as your search path and to find any older verisons of\nPython that may be slithering around your computer, which Anaconda is programmed to do.<\/p>\n\n\n\n<p>Sixth, from the start menu included in the program, look for a button called &#8220;idle&#8221; which provides you with a programming\nenvironment that is the default, most commonly included programming environment, simplistic and basic, included with the\nvast majority of Python distributions. When you fire up IDLE, you should see a window before you that consists of a &#8220;shell&#8221;\nor a sort of command prompt, that is utilizing a Python interpreter to understand your commands. This is where you can\ntype and execute your Python compatible statements.<\/p>\n\n\n\n<p>Seventh, you will want to write a script. Begin this by going to New in the File menu, in order to create a new script file.\nInsert some Python code and then click Save from the File menu. Proceed to pick a name for your file and then save it to\na location in your home folder, which is usually the default installation folder of Anaconda, or the location could be\nautomatically set to point to the script folder within Anaconda&#8217;s directory.<\/p>\n\n\n\n<p>Eighth, you can execute the script by selecting the Run Module field in the Run menu, or by pressing F5 on your keyboard.\nIf the code executed properly, you should now see the fruit of your labor before you. If not, then there will be some error\nmessages to guide you as to what went wrong.<\/p>\n\n\n\n<p>As far as troubleshooting goes, if you&#8217;ve already installed a previous version of Python on your computer, there is a good\nchance you will run into some compatibility or conflict issues when attempting to run an old version of the software by\naccident as opposed to the fresher version. In order to see if everything is fine, try to run Python or IDLE and see if\nyou can check the version information for what you&#8217;re running. It should be written there for you to see. You should be\nable to see some version of Python 3, and some version of Anaconda 2. If you don&#8217;t see either of these, then you are most\nlikely not running the latest version that we&#8217;ve instructed you to install. With a little bit of searching, you might have\nsome success in finding the right shortcut that is used to launch the right and more recent version of Python. In case\nyou don&#8217;t figure this out, you can always attempt to reinstall the software and either change the path or have the\ninstallation package figure out the path for you. <\/p>\n\n\n\n<p><b>INSTRUCTION 4: Operating Jupyter.<\/b><\/p>\n\n\n\n<p>If you installed Python with Anaconda, and chose the default installation values, then it is very likely that you also\ninstalled Jupyter, which is an interactive development environment or IDE for short, that can be used with Python as well\nas other programming languages. Until some time ago, Jupyter was referred to as IPython, so you might see that name pop\nup here and there. <\/p>\n\n\n\n<p>Going to the start menu, look for Jupyter. The search results will most likely yield several choices, including:<\/p>\n\n\n\n<p>&#8211; Jupyter has a Python interpreter embedded in it&#8217;s launch module and by default comes with supplemental features that\nyou might find useful.<\/p>\n\n\n\n<p>&#8211; Jupyter QTConsole actually has a Python interpreter that is displayed to you in a sort of graphics based environment\nover purely a text based one.<\/p>\n\n\n\n<p>&#8211; Jupyter Notebook will boot up Python but it will run in a browser as opposed to as a desktop application.<\/p>\n\n\n\n<p>In that case, Jupyter Notebook comes highly recommended. In order to launch Jupyter Notebook, open up the command line\nand type:<\/p>\n\n\n\n<p>s jupyter notebook<\/p>\n\n\n\n<p>You can find additional material on Jupyter&#8217;s website regarding Jupyter Notebook here: https:\/\/jupyter.org\/documentation<\/p>\n","protected":false},"excerpt":{"rendered":"<p><span class=\"span-reading-time rt-reading-time\" style=\"display: block;\"><span class=\"rt-label rt-prefix\">Reading Time: <\/span> <span class=\"rt-time\"> 7<\/span> <span class=\"rt-label rt-postfix\">minutes<\/span><\/span>As a beginner, you will want to start out following these instructions: 1. Using an online &#8220;Python in your browser&#8221; service such as PythonAnywhere in order to be able to run code interactively, which essentially means you can type and execute a single line of code, one after another, and therefore test your code as [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_et_pb_use_builder":"","_et_pb_old_content":"","_et_gb_content_width":"","footnotes":""},"categories":[113],"tags":[],"class_list":["post-1881","post","type-post","status-publish","format-standard","hentry","category-thinking-like-programmer-using-python"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.methodologydesign.com\/index.php\/wp-json\/wp\/v2\/posts\/1881","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.methodologydesign.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.methodologydesign.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.methodologydesign.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.methodologydesign.com\/index.php\/wp-json\/wp\/v2\/comments?post=1881"}],"version-history":[{"count":2,"href":"https:\/\/www.methodologydesign.com\/index.php\/wp-json\/wp\/v2\/posts\/1881\/revisions"}],"predecessor-version":[{"id":1884,"href":"https:\/\/www.methodologydesign.com\/index.php\/wp-json\/wp\/v2\/posts\/1881\/revisions\/1884"}],"wp:attachment":[{"href":"https:\/\/www.methodologydesign.com\/index.php\/wp-json\/wp\/v2\/media?parent=1881"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.methodologydesign.com\/index.php\/wp-json\/wp\/v2\/categories?post=1881"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.methodologydesign.com\/index.php\/wp-json\/wp\/v2\/tags?post=1881"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}