{"id":1960,"date":"2024-01-26T18:41:19","date_gmt":"2024-01-26T18:41:19","guid":{"rendered":"https:\/\/www.tutavo.com\/Kachina\/?p=1960"},"modified":"2024-02-04T23:54:13","modified_gmt":"2024-02-04T23:54:13","slug":"learn-python-notes-1-10","status":"publish","type":"post","link":"https:\/\/www.tutavo.com\/Kachina\/learn-python-notes-1-10\/","title":{"rendered":"Learn Python &#8211; NOTES 1 &#8211; 10"},"content":{"rendered":"<p>https:\/\/edube.org\/login &#8211; Python 3 or CPython<br \/>\nProgramming tool is IDLE<\/p>\n<p>https:\/\/docs.python.org\/3\/library\/functions.html<\/p>\n<p><strong># Sample Python Program 01<\/strong><\/p>\n<p># Get user input for name<br \/>\nname = input(&#8220;Enter your name: &#8220;)<br \/>\n# Get user input for age<br \/>\nage = input(&#8220;Enter your age: &#8220;)<br \/>\n# Convert age to an integer<br \/>\nage = int(age)<br \/>\n# Print a personalized greeting<br \/>\nprint(f&#8221;Hello, {name}! You are {age} years old.&#8221;)<\/p>\n<p><strong># Sample Python Program 02<\/strong><\/p>\n<p># Using the f function<br \/>\nprint(f&#8221;Hello, {second}! You are {first} years old.&#8221;)<br \/>\nprint(&#8220;Hello, {second}! You are {first} years old.&#8221;)<\/p>\n<p><strong># Sample Python Program 03<\/strong><\/p>\n<p><strong># Using the end and sep functions within print()<\/strong><br \/>\nprint(&#8220;Programming&#8221;,&#8221;Essentials&#8221;,&#8221;in&#8221;,sep=&#8221;***&#8221;,end=&#8221;&#8230;&#8221;)<br \/>\nprint(&#8220;Python&#8221;)<br \/>\n# THIS WILL DISPLAY &#8211; Programming***Essentials***in&#8230;Python<br \/>\n<code class=\"codep syntax-color\"><\/code><\/p>\n<p><strong># Sample Python Program 04<\/strong><\/p>\n<p># PLAYING AROUND WITH end and sep<br \/>\nprint(&#8221; *&#8221;)<br \/>\nprint(&#8221; * *&#8221;)<br \/>\nprint(&#8221; * *&#8221;)<br \/>\nprint(&#8221; * *&#8221;)<br \/>\nprint(&#8216;*** ***&#8217;)<br \/>\nprint(&#8221; * *&#8221;)<br \/>\nprint(&#8221; * *&#8221;)<br \/>\nprint(&#8221; *****&#8221;)<br \/>\n# *<br \/>\n# * *<br \/>\n# * *<br \/>\n# * *<br \/>\n# *** ***<br \/>\n# * *<br \/>\n# * *<br \/>\n# *****<code class=\"codep syntax-color\"><\/code><\/p>\n<p><strong># Sample Python Program 05<\/strong><code class=\"codep syntax-color\"><\/code><\/p>\n<p># Octals and Hexidecimals and Base 10<br \/>\nprint(0o123)<br \/>\nprint(0x123)<br \/>\nprint (123)<br \/>\nprint (&#8220;123&#8221;)<\/p>\n<p><strong><code class=\"codep syntax-color\"><\/code># Sample Python Program 06<\/strong><\/p>\n<p><code class=\"codep syntax-color\"><span class=\"ace_keyword\"># Forcing quotes to appear in print<\/span><br \/>\nprint(\"I like \\\"Monty Python\\\"\")<br \/>\nprint(\"I like 'Monty Python'\")<br \/>\nprint('I like \"Monty Python\"')<br \/>\nprint(\"I like \\'Monty Python\\'\")<\/code><\/p>\n<p><strong><code class=\"codep syntax-color\"><\/code># Sample Python Program 07<\/strong><\/p>\n<p># print three lines with a single line of code<\/p>\n<p>&#8220;I&#8217;m&#8221; ,<br \/>\n&#8220;&#8221;learning&#8221;&#8221; ,<br \/>\n&#8220;&#8221;&#8221;Python&#8221;&#8221;&#8221;<\/p>\n<p>One long string<br \/>\nprint(&#8221; \\&#8221;I\\&#8217;m\\&#8221; &nbsp; &nbsp;&nbsp; \\n \\&#8221;\\&#8221;learning\\&#8221;\\&#8221;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \\n \\&#8221;\\&#8221;\\&#8221;Python\\&#8221;\\&#8221;\\&#8221; &#8220;)<br \/>\nThree shorter strings<br \/>\nprint(&#8220;\\&#8221;I&#8217;m\\&#8221;&#8221; , &#8220;\\n\\&#8221;\\&#8221;learning\\&#8221;\\&#8221;&#8221; , &#8220;\\n\\&#8221;\\&#8221;\\&#8221;Python\\&#8221;\\&#8221;\\&#8221;&#8221;)<br \/>\nUsing the SEP function<br \/>\nprint(&#8220;\\&#8221;I&#8217;m\\&#8221;&#8221; , &#8220;\\&#8221;learning\\&#8221;\\&#8221;&#8221; , &#8220;\\&#8221;\\&#8221;Python\\&#8221;\\&#8221;\\&#8221;&#8221;,sep=&#8221;\\n&#8221;)<\/p>\n<p><strong><code class=\"codep syntax-color\"><\/code># Sample Python Program 08<\/strong><\/p>\n<p># Try to understand the ** operator<br \/>\nprint ((2**0) + (2**1) + (2**3))<br \/>\nprint (2**0)<br \/>\nprint (2**1)<br \/>\nprint (2**3)<\/p>\n<p>print ((2**0) + (2**1) + (2**2) + (2**3))<br \/>\nprint (2**0)<br \/>\nprint (2**1)<br \/>\nprint (2**2)<br \/>\nprint (2**3)<\/p>\n<p><strong><code class=\"codep syntax-color\"><\/code># Sample Python Program 09<\/strong><\/p>\n<p># Mathematical Operators<br \/>\n<code>+&nbsp;&nbsp;&nbsp;<\/code> <code>-&nbsp;&nbsp;&nbsp;<\/code> <code>*&nbsp;&nbsp;&nbsp;<\/code> <code>\/ &nbsp;&nbsp;<\/code> <code>\/\/&nbsp;&nbsp;&nbsp;<\/code> <code>%&nbsp;&nbsp;&nbsp;<\/code> <code>**<\/code><\/p>\n<p><strong><code class=\"codep syntax-color\"><\/code># Sample Python Program 10<br \/>\n#Significant digits<br \/>\n<\/strong><\/p>\n<p>print(2 ** 3) # this results in an integer<br \/>\nprint(2 ** 3.) # this results in a float<br \/>\nprint(2. ** 3) # this results in a float<br \/>\nprint(2. ** 3.) # this results in a float<\/p>\n<p>Division is always a float, unless&#8230;<br \/>\nprint(6 \/ 3)<br \/>\nprint (int(6 \/ 3))&nbsp;&nbsp; # or<br \/>\nprint(6 \/\/ 3)&nbsp;&nbsp;&nbsp;&nbsp; # (forces integer as a result &#8211; TRUNCATES &#8211; does not round<br \/>\nprint(6 \/ 3.)<br \/>\nprint(6. \/ 3)<br \/>\nprint(6. \/ 3.)<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>https:\/\/edube.org\/login &#8211; Python 3 or CPython Programming tool is IDLE https:\/\/docs.python.org\/3\/library\/functions.html # Sample Python Program 01 # Get user input for name name = input(&#8220;Enter your name: &#8220;) # Get user input for age age = input(&#8220;Enter your age: &#8220;) # Convert age to an integer age = int(age) # Print a personalized greeting print(f&#8221;Hello, &hellip; <a href=\"https:\/\/www.tutavo.com\/Kachina\/learn-python-notes-1-10\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Learn Python &#8211; NOTES 1 &#8211; 10&#8221;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"ngg_post_thumbnail":0,"footnotes":""},"categories":[9],"tags":[],"class_list":["post-1960","post","type-post","status-publish","format-standard","hentry","category-educational"],"_links":{"self":[{"href":"https:\/\/www.tutavo.com\/Kachina\/wp-json\/wp\/v2\/posts\/1960","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.tutavo.com\/Kachina\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tutavo.com\/Kachina\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tutavo.com\/Kachina\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tutavo.com\/Kachina\/wp-json\/wp\/v2\/comments?post=1960"}],"version-history":[{"count":14,"href":"https:\/\/www.tutavo.com\/Kachina\/wp-json\/wp\/v2\/posts\/1960\/revisions"}],"predecessor-version":[{"id":2024,"href":"https:\/\/www.tutavo.com\/Kachina\/wp-json\/wp\/v2\/posts\/1960\/revisions\/2024"}],"wp:attachment":[{"href":"https:\/\/www.tutavo.com\/Kachina\/wp-json\/wp\/v2\/media?parent=1960"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tutavo.com\/Kachina\/wp-json\/wp\/v2\/categories?post=1960"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tutavo.com\/Kachina\/wp-json\/wp\/v2\/tags?post=1960"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}