{"id":33120,"date":"2016-02-19T21:28:40","date_gmt":"2016-02-20T03:28:40","guid":{"rendered":"http:\/\/alextenablog.wordpress.com\/?p=135"},"modified":"2016-02-19T23:50:19","modified_gmt":"2016-02-20T05:50:19","slug":"wsq05-8","status":"publish","type":"post","link":"https:\/\/kenscourses.com\/tc101winter2016\/2016\/02\/wsq05-8\/","title":{"rendered":"#WSQ05"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" class=\" aligncenter\" src=\"http:\/\/kenscourses.com\/tc101winter2016\/wp-content\/uploads\/2016\/02\/aea110a63477caa525fab7df08e83970.jpg\" alt=\"\" width=\"225\" height=\"225\" \/><\/p>\n<p>&nbsp;<\/p>\n<p><strong>With this program I learned the basics of the conditionals in python.<\/strong><\/p>\n<p><strong>The if, elif and else are functions that evaluate certain conditions and if such condition is true, the program executes a certain code, that code would be the statement of the condition. There can be multiple if, elif and else in your code.\u00a0<\/strong><\/p>\n<p><strong>This page is helpful for understandig this concept-\u00a0https:\/\/docs.python.org\/3.5\/tutorial\/controlflow.html<\/strong><\/p>\n<p><strong><img decoding=\"async\" class=\" aligncenter\" src=\"http:\/\/kenscourses.com\/tc101winter2016\/wp-content\/uploads\/2016\/02\/a4eaa7f904370d0eac4b4cbdaa750073.jpg\" alt=\"\" \/><\/strong><\/p>\n<p>&nbsp;<\/p>\n<p><strong>For this program we have to ask the user for a temperature in Farenheit. Then the program has to convert that value to a temperature in Celsius. Also we have to tell the user if water boils or doesn\u00b4t at that temperature<\/strong><\/p>\n<p><strong>The formula for converting Celsius to Farenheit is:<\/strong><\/p>\n<p><strong>C\u00ba= 5*(F\u00ba-32)\/9<\/strong><\/p>\n<p><strong>Doing that is the first part of the code, and probably the easiest part.\u00a0<\/strong><\/p>\n<p><strong><em>print (&#8220;What is the temperature in Farenheit?&#8221;) <\/em><\/strong><br \/>\n<strong><em>temp=input()<\/em><\/strong><br \/>\n<strong><em>deg=&#8221;degrees&#8221; <\/em><\/strong><br \/>\n<strong><em>cel= 5*(int(temp)-32)\/\/9<\/em><\/strong><br \/>\n<strong><em>print (&#8220;The temperature in Celsius is:&#8221;, cel, deg)<\/em><\/strong><\/p>\n<p><strong>The next part requires the use of the if and else functions.<\/strong><\/p>\n<p><strong><em>if cel &lt; 100 and cel &gt; 0:<\/em><\/strong><br \/>\n<strong><em> print (&#8220;Water does not boil at this temperature (under typical conditions).&#8221;)<\/em><\/strong><br \/>\n<strong><em>if cel &gt; 100:<\/em><\/strong><br \/>\n<strong><em> print (&#8220;Water boils at this temperature (under typical conditions).&#8221;)<\/em><\/strong><br \/>\n<strong><em>if cel&lt;0:<\/em><\/strong><br \/>\n<strong><em> print (&#8220;Water freezes at this temperature&#8221;)<\/em> <\/strong><\/p>\n<p><strong>The complete code would look like this:<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone  wp-image-171\" src=\"http:\/\/kenscourses.com\/tc101winter2016\/wp-content\/uploads\/2016\/02\/5967220ba26efff552c9ce1178514b49.jpg#038;h=386\" alt=\"temp\" width=\"647\" height=\"386\" \/><\/p>\n<p><strong>And the program running, like this:<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-175\" src=\"http:\/\/kenscourses.com\/tc101winter2016\/wp-content\/uploads\/2016\/02\/6665fefbfd8201a68eba3b3b6337caac.jpg\" alt=\"temp2\"   \/><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\" alignright\" src=\"http:\/\/kenscourses.com\/tc101winter2016\/wp-content\/uploads\/2016\/02\/216d2fd696024f4f339e57213d0fb7ae.jpg\" alt=\"\" width=\"398\" height=\"147\" \/><\/p>\n<p>  <a rel=\"nofollow\" href=\"http:\/\/feeds.wordpress.com\/1.0\/gocomments\/alextenablog.wordpress.com\/135\/\"><img decoding=\"async\" alt=\"\" border=\"0\" src=\"http:\/\/kenscourses.com\/tc101winter2016\/wp-content\/uploads\/2016\/02\/93e967a7cb79d7d735b7cb9675ae3d98.jpg\" \/><\/a> <img loading=\"lazy\" decoding=\"async\" alt=\"\" border=\"0\" src=\"http:\/\/kenscourses.com\/tc101winter2016\/wp-content\/uploads\/2016\/02\/6281dc401a2dc253a7c498aa84d833d4.jpg#038;blog=105328326&#038;%23038;post=135&#038;%23038;subd=alextenablog&#038;%23038;ref=&#038;%23038;feed=1\" width=\"1\" height=\"1\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp; With this program I learned the basics of the conditionals in python. The if, elif and else are functions that evaluate certain conditions and if such condition is true, the program executes a certain code, that code would be the statement of the condition. There can be multiple if, elif and else in your &hellip; <a href=\"https:\/\/kenscourses.com\/tc101winter2016\/2016\/02\/wsq05-8\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">#WSQ05<\/span><\/a><\/p>\n","protected":false},"author":46,"featured_media":33187,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,4],"tags":[84],"class_list":["post-33120","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blogs","category-syndicated","tag-wsq05"],"_links":{"self":[{"href":"https:\/\/kenscourses.com\/tc101winter2016\/wp-json\/wp\/v2\/posts\/33120","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kenscourses.com\/tc101winter2016\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kenscourses.com\/tc101winter2016\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kenscourses.com\/tc101winter2016\/wp-json\/wp\/v2\/users\/46"}],"replies":[{"embeddable":true,"href":"https:\/\/kenscourses.com\/tc101winter2016\/wp-json\/wp\/v2\/comments?post=33120"}],"version-history":[{"count":2,"href":"https:\/\/kenscourses.com\/tc101winter2016\/wp-json\/wp\/v2\/posts\/33120\/revisions"}],"predecessor-version":[{"id":33198,"href":"https:\/\/kenscourses.com\/tc101winter2016\/wp-json\/wp\/v2\/posts\/33120\/revisions\/33198"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/kenscourses.com\/tc101winter2016\/wp-json\/wp\/v2\/media\/33187"}],"wp:attachment":[{"href":"https:\/\/kenscourses.com\/tc101winter2016\/wp-json\/wp\/v2\/media?parent=33120"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kenscourses.com\/tc101winter2016\/wp-json\/wp\/v2\/categories?post=33120"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kenscourses.com\/tc101winter2016\/wp-json\/wp\/v2\/tags?post=33120"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}