{"id":187,"date":"2020-11-07T11:00:35","date_gmt":"2020-11-07T11:00:35","guid":{"rendered":"http:\/\/lamiaiftekhar.com\/?page_id=187"},"modified":"2020-11-07T11:00:35","modified_gmt":"2020-11-07T11:00:35","slug":"20-minutes-python-day-1","status":"publish","type":"page","link":"https:\/\/lamiaiftekhar.com\/index.php\/20-minutes-python-day-1\/","title":{"rendered":"20-Minutes Python: Day 1"},"content":{"rendered":"<body>\n<p class=\"wp-block-paragraph\">Today we will be printing stuff!\u00a0<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">1.\u00a0\u00a0\u00a0\u00a0 In a cell, write\u00a0\u00a0 <strong>print(\u201cOkay, let us start!\u201d)<\/strong>\u00a0\u00a0\u00a0<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Then press Shift+Enter (run it).\u00a0<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 You should get a nice output.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">2. In the next cell, write <strong>print(\u2018Okay, let us start!\u2019).<\/strong>\u00a0 Note the single quotation.\u00a0<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u00a0Then run it.\u00a0 What do you get<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">3. You should get the same thing in 2 and 1.\u00a0\u00a0 Now\u00a0 write <strong>\u00a0print(\u2018Let\u2019s go!\u2019)<\/strong>.\u00a0\u00a0 Then run it.\u00a0 What do you get?<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">4. What is the problem in 3?\u00a0\u00a0 The phrase to print has an apostrophe which\u00a0 Python thinks is the end of the phrase and gets confused.\u00a0 So if you have an apostrophe in your sentence,\u00a0 it is better to print\u00a0 with double quotations.\u00a0 Try it and print\u00a0 <em>Let\u2019s go!<\/em><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">5. If you insist on using single quotations you can use\u00a0\u00a0\u00a0 <strong>\\\u2019<\/strong>\u00a0\u00a0 for the apostrophe.\u00a0\u00a0\u00a0 Now, try that and print\u00a0 <em>Let\u2019s go!<\/em><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">6. If you had used two print commands in the same cell ( for example while doing 4 ), you will notice that Python moves to a new line after executing the first print command, even if you put two print commands in the same line to save space ( in that case you have to use\u00a0 a semicolon) .\u00a0 Try this\u00a0 by typing <strong>print(\u2018In brightest day, in blackest night\u2019);\u00a0 print (\u2018No evil shall escape by sight\u2019) <\/strong>\u00a0in\u00a0 the same line in a cell.\u00a0 Run it<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">7. Now type\u00a0\u00a0 <strong>print(\u2018In brightest day, in blackest night\u2019)<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <strong>\u00a0print (\u2018No evil shall escape by sight\u2019)<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u00a0in two different lines but in the same cell.\u00a0 Run it<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">8. 5 and 6 shall give you the same result.\u00a0\u00a0 Now we will do an <em>EXERCISE<\/em>!\u00a0\u00a0\u00a0 Print the following exactly as it is \u2013\u00a0 with all the tabs and indentation.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I wanna be the very best,<br>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0That no one ever was!<br>To catch them is my real test,<br>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0To train them is my cause.<br>\u00a0<br>I\u2019ll travel across the land,\u00a0<br>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Searching far and wide \u2013<br>Each Pokemon to understand<br>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 The power that\u2019s inside.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Hint:\u00a0\u00a0<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You can insert an empty line using <strong>print(\u201d \u201c)<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Different escape sequences in python:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Escape Sequence\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Meaning<br>\\t\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Tab<br>\\\\\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Inserts a back slash (\\)<br>\\\u2019\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Inserts a single quote (\u2018)<br>\\\u201d\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Inserts a double quote (\u201c)<br>\\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Inserts a ASCII Linefeed (a new line)<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">From &lt;<a href=\"https:\/\/stackoverflow.com\/questions\/4488570\/how-do-i-write-a-tab-in-python\">https:\/\/stackoverflow.com\/questions\/4488570\/how-do-i-write-a-tab-in-python<\/a>&gt;<\/p>\n<\/body>","protected":false},"excerpt":{"rendered":"<p>Today we will be printing stuff!\u00a0 1.\u00a0\u00a0\u00a0\u00a0 In a cell, write\u00a0\u00a0 print(\u201cOkay, let us start!\u201d)\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Then press Shift+Enter (run it).\u00a0 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 You should get a nice output. 2. In the next cell, write print(\u2018Okay, let us start!\u2019).\u00a0 Note the single quotation.\u00a0 \u00a0Then run it.\u00a0 What do you get 3. You should get the same [&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-187","page","type-page","status-publish","hentry","entry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/lamiaiftekhar.com\/index.php\/wp-json\/wp\/v2\/pages\/187","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=187"}],"version-history":[{"count":1,"href":"https:\/\/lamiaiftekhar.com\/index.php\/wp-json\/wp\/v2\/pages\/187\/revisions"}],"predecessor-version":[{"id":191,"href":"https:\/\/lamiaiftekhar.com\/index.php\/wp-json\/wp\/v2\/pages\/187\/revisions\/191"}],"wp:attachment":[{"href":"https:\/\/lamiaiftekhar.com\/index.php\/wp-json\/wp\/v2\/media?parent=187"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}