{"id":211,"date":"2020-11-10T09:32:21","date_gmt":"2020-11-10T09:32:21","guid":{"rendered":"http:\/\/lamiaiftekhar.com\/?page_id=211"},"modified":"2020-11-10T09:32:21","modified_gmt":"2020-11-10T09:32:21","slug":"20-minutes-python-day-6","status":"publish","type":"page","link":"https:\/\/lamiaiftekhar.com\/index.php\/20-minutes-python-day-6\/","title":{"rendered":"20-Minutes Python: Day 6"},"content":{"rendered":"<body>\n<p class=\"wp-block-paragraph\">Ok, now that you can make pretty documents using Markdown,\u00a0 let\u2019s get back to some Code type cells!\u00a0<br>\u00a0<br>So far, we just learned printing things.\u00a0\u00a0 Now we will go into variables!\u00a0<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u00a0<br>Let\u2019s learn three types of variables \u2013\u00a0\u00a0\u00a0 integer, float (decimals)\u00a0 and strings (word\/phrase\/\u00a0 sentence)<br>\u00a0<br>\u00a0<br>1. Write\u00a0\u00a0<strong> a = 9<br>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 print(a)<\/strong><br>\u00a0\u00a0\u00a0\u00a0\u00a0 Run this.\u00a0\u00a0 What type of variable is\u00a0 a?\u00a0\u00a0\u00a0<br>\u00a0\u00a0\u00a0 Notice that, we do not have to worry about \u2018declaring\u2019 a variable or type specifically.\u00a0 Python understand right away \ud83d\ude00<br>\u00a0<br>2. Write\u00a0 \u00a0<strong>b = 9.0<br>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 print (b)<\/strong><br>Run it. What type of variable is b?<br>\u00a0<br>3. You can also make a float variable according to the following:<br>\u00a0<br>Write \u00a0<strong>c = float(9)<br>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 print(c)<\/strong><br>\u00a0<br>4. You can make strings using either double quotation or single quotation, like the way we learnt while learning about the print function in Day 1.\u00a0 Ensure you use double quotation when your string\u00a0 has an apostrophe. ( Else you have to use an \\\u2019 )<br>\u00a0<br>Write\u00a0\u00a0\u00a0 <strong>string1 = \u2018kamehameha\u2019<\/strong><br>Print the string.<br>\u00a0<br>\u00a0<br>5. Write <strong>string 2 = \u201d It\u2019s the final countdown!\u201d<\/strong><br>Print the string.<br>\u00a0<br>6. Define a new string\u00a0\u00a0 which , when printed will give the same output as 5 above \u2013 but use SINGLE\u00a0 quotation.\u00a0\u00a0<br>\u00a0<br><strong>string3 = \u2018It\\\u2019s the final countdown!\u2019<\/strong><br>\u00a0<br>\u00a0<br>\u00a0 \u2018\\\u2019\u00a0 is a way to use special characters which otherwise have different meanings and purposes\u00a0 in Python.\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Here is a list of special characters.\u00a0 https:\/\/www.stat.berkeley.edu\/~spector\/extension\/python\/notes\/node14.html<br>\u00a0<br>\u00a0<br>\u00a0<br>7. Exercise:<br>\u00a0<br>Make a\u00a0 string called\u00a0 someFancyLine , which when printed will give the following:<br>\u00a0<br>\u00a0<br><strong>And then he yelled\\sang, \u201cIt\u2019s the finaaal countdooown!<br>\u00a0Ta na\u00a0 naaa na\u00a0<br>\u00a0Ta na nanana<br>\u00a0Ta na naaa na<br>\u00a0Ta na nana nanana!\u201d\u00a0<\/strong><\/p>\n<\/body>","protected":false},"excerpt":{"rendered":"<p>Ok, now that you can make pretty documents using Markdown,\u00a0 let\u2019s get back to some Code type cells!\u00a0\u00a0So far, we just learned printing things.\u00a0\u00a0 Now we will go into variables!\u00a0 \u00a0Let\u2019s learn three types of variables \u2013\u00a0\u00a0\u00a0 integer, float (decimals)\u00a0 and strings (word\/phrase\/\u00a0 sentence)\u00a0\u00a01. Write\u00a0\u00a0 a = 9\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 print(a)\u00a0\u00a0\u00a0\u00a0\u00a0 Run this.\u00a0\u00a0 What type of variable [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"class_list":["post-211","page","type-page","status-publish","hentry","entry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/lamiaiftekhar.com\/index.php\/wp-json\/wp\/v2\/pages\/211","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lamiaiftekhar.com\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/lamiaiftekhar.com\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/lamiaiftekhar.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lamiaiftekhar.com\/index.php\/wp-json\/wp\/v2\/comments?post=211"}],"version-history":[{"count":1,"href":"https:\/\/lamiaiftekhar.com\/index.php\/wp-json\/wp\/v2\/pages\/211\/revisions"}],"predecessor-version":[{"id":212,"href":"https:\/\/lamiaiftekhar.com\/index.php\/wp-json\/wp\/v2\/pages\/211\/revisions\/212"}],"wp:attachment":[{"href":"https:\/\/lamiaiftekhar.com\/index.php\/wp-json\/wp\/v2\/media?parent=211"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}