{"id":126680,"date":"2020-01-19T10:44:50","date_gmt":"2020-01-19T02:44:50","guid":{"rendered":"http:\/\/4563.org\/?p=126680"},"modified":"2020-01-19T10:44:50","modified_gmt":"2020-01-19T02:44:50","slug":"%e8%bf%99%e4%b8%aa-python-%e5%88%9d%e7%ba%a7%e4%bb%a3%e7%a0%81%e7%9a%84%e9%94%99%e8%af%af%e5%9c%a8%e5%93%aa%e9%87%8c%ef%bc%9f-%e6%b1%82%e5%a4%a7%e7%a5%9e%e6%8c%87%e5%af%bc%ef%bc%81","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=126680","title":{"rendered":"\u8fd9\u4e2a Python \u521d\u7ea7\u4ee3\u7801\u7684\u9519\u8bef\u5728\u54ea\u91cc\uff1f \u6c42\u5927\u795e\u6307\u5bfc\uff01"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  \u8fd9\u4e2a Python \u521d\u7ea7\u4ee3\u7801\u7684\u9519\u8bef\u5728\u54ea\u91cc\uff1f \u6c42\u5927\u795e\u6307\u5bfc\uff01               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : chanelleemr <\/span>  <span><i><\/i> 7<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<h1>Cousera \u4e0a\u7684\u4e00\u4e2a\u8bfe\u7a0b\u4f5c\u4e1a\uff0c\u76ee\u7684\u662f\u5141\u8bb8\u7528\u6237\u8fde\u7eed\u8f93\u5165\u51e0\u4e2a\u6574\u6570\u3001\u6bd4\u8f83\u5b83\u4eec\u7684\u5927\u5c0f\u3002<\/h1>\n<p> <\/p>\n<h1>\u8fd9\u91cc\u6211\u5b9a\u4e49\u4e86\u4e24\u4e2a\u51fd\u6570\u6765\u8fdb\u884c\u6bd4\u8f83\uff0c\u7ed3\u679c\u663e\u793a\u4e00\u76f4\u662f none\uff0c\u4e0d\u77e5\u9053\u662f\u54ea\u4e00\u6b65\u9519\u4e86\uff0c\u671b\u5404\u4f4d\u4e0d\u541d\u8d50\u6559<\/h1>\n<p> <\/p>\n<h1>initiate the min\/max value<\/h1>\n<p> <\/p>\n<p>largest = None smallest = None<\/p>\n<h1>we could define the function of comparison with def()<\/h1>\n<p> <\/p>\n<p>def larger(largest, fnum): if largest is None: largest = fnum else: if largest &lt; fnum: largest = fnum return smallest<\/p>\n<p>def smaller(smallest, fnum): if smallest is None: smallest = fnum else: if smallest &gt; fnum: smallest = fnum return smallest<\/p>\n<h1>use while to make loop<\/h1>\n<p> <\/p>\n<p>while True:<\/p>\n<h1>let user input the numbers<\/h1>\n<p> <\/p>\n<pre><code>snum = input('Enter a number: ') <\/code><\/pre>\n<h1>insert the if (done)<\/h1>\n<p> <\/p>\n<pre><code>if snum == \"done\":     break <\/code><\/pre>\n<h1>Transfer to float type<\/h1>\n<p> <\/p>\n<h1>we use try\/except to aviod explosion<\/h1>\n<p> <\/p>\n<pre><code>try:     fnum = int(snum) except:     print (\"Invalid input\")     continue <\/code><\/pre>\n<h1>make comparison (MAX)<\/h1>\n<p> <\/p>\n<pre><code>larger(largest, fnum) <\/code><\/pre>\n<h1>make comparison (MIN)<\/h1>\n<p> <\/p>\n<pre><code>smaller(smallest, fnum) <\/code><\/pre>\n<h1>print the result<\/h1>\n<p> <\/p>\n<p>print (&#8220;Maximum is&#8221;, largest) print (&#8220;Minimum is&#8221;, smallest)<\/p>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>9<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"2185390\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : flyhelan <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4ee3\u7801\u8d34\u5168\u4e86\uff1f                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"2185391\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : xiri <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u989d\uff0c\uff0c\uff0c\u4f60\u5148\u5b66\u4e00\u4e0b markdown \u8bed\u6cd5\u600e\u4e48\u53d1\u4ee3\u7801\u5427\uff0c\u8fd9\u683c\u5f0f\u5168\u4e71\u4e86<br \/>\u6ca1\u6709\u7ec6\u770b\u4f60\u7684\u5b9e\u73b0\uff0c\u5355\u5c31\u4f60\u7684\u9700\u6c42\uff0cpython \u4e2d\u6709 max \u548c min \u51fd\u6570\u53ef\u4ee5\u76f4\u63a5\u4f7f\u7528\u5c31\u884c\u4e86\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"2185392\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : aureole999 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u770b\u4e0d\u6e05\u695a\u3002<br \/>\u5927\u6982\u662f largest = larger(largest, fnum) \u540c\u7406 smaller                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"2185393\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : Evrins <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             largest \u548c smallest \u7684\u503c\u6ca1\u6709\u66f4\u65b0\u5440\uff0cfunction \u4f20\u53c2\u6570\u662f\u4f20\u503c\uff0c\u4e0d\u662f\u4f20\u5f15\u7528\uff0cfunction \u91cc\u9762\u7684 largest, smallest \u5e76\u4e0d\u6307\u5411\u524d\u9762\u5b9a\u4e49\u7684 largest, smallest                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"2185394\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : black11black <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u5f88\u660e\u663e\u662f\u628a py \u5f53 c \u5199\u4e86                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"2185395\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : chanelleemr <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @Evrins \u8c22\u8c22\uff01\u95ee\u9898\u5df2\u89e3\u51b3                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"2185396\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : chanelleemr <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @Evrins <br \/>@aureole999 <br \/>\u95ee\u9898\u5df2\u89e3\u51b3\uff0c\u8c22\u8c22\u4e8c\u4f4d                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"2185397\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : gzfrankie <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u5708\u5b50\u95ee\u9898\u52a0\u6211\u56fd\u7279\u8272\u3002<\/p>\n<p>\u4f60\u770b\u770b MAGA \u54ea\u4e00\u5bb6\u662f\u7528 JAVA \u4e3b\u6d41\u642d\u51fa\u6765\u7684\u2026<\/p>\n<p>\u53e6\u5916\u4f60\u54ea\u91cc\u770b\u5341\u624b tiobe\uff0c2020 \u5e74 6 \u6708 tiobe.com\/tiobe-index<\/p>\n<p>1. C 17.19%<br \/>2. Java 16.10%<br \/>3. Python 8.36%<br \/>4. C++ 5.95%<br \/>5-10 C#\u3001VB \u3001JS \u3001PHP \u3001R \u3001SQL                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"2185398\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : gzfrankie <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4f1a\u9519\u5e16\u5b50\u4e86\u2026\u2026                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>\u8fd9\u4e2a Python \u521d\u7ea7\u4ee3\u7801\u7684\u9519\u8bef&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/126680"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=126680"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/126680\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=126680"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=126680"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=126680"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}