{"id":169707,"date":"2020-10-15T22:12:33","date_gmt":"2020-10-15T14:12:33","guid":{"rendered":"http:\/\/4563.org\/?p=169707"},"modified":"2020-10-15T22:12:33","modified_gmt":"2020-10-15T14:12:33","slug":"%e5%a4%a7%e4%bd%ac%e4%bb%ac%ef%bc%8c%e4%b8%80%e4%b8%aa%e5%85%b3%e4%ba%8e-list-%e7%9a%84%e4%bd%9c%e4%b8%9a%e4%b8%8d%e4%bc%9a%e5%81%9a%ef%bc%8c%e6%b1%82%e6%8c%87%e5%af%bc","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=169707","title":{"rendered":"\u5927\u4f6c\u4eec\uff0c\u4e00\u4e2a\u5173\u4e8e list \u7684\u4f5c\u4e1a\u4e0d\u4f1a\u505a\uff0c\u6c42\u6307\u5bfc"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  \u5927\u4f6c\u4eec\uff0c\u4e00\u4e2a\u5173\u4e8e list \u7684\u4f5c\u4e1a\u4e0d\u4f1a\u505a\uff0c\u6c42\u6307\u5bfc               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : gypsy <\/span>  <span><i><\/i> 3<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\">                        \u5c31\u662f\u628a\u7528\u6237\u8f93\u5165\u7684 list \u91cc\u7684\u6570\u5b57\u8f6c\u6362\u6210 x \u6570\u91cf\u7684\u661f\u53f7\u3002\u76ee\u524d\u5361\u5728\u4e24\u4e2a\u5730\u65b9<br \/>1.input \uff08\uff09\u547d\u4ee4\u53ef\u4ee5\u8f93\u5165 list \u5417\uff1f<br \/>2. \u53ef\u4ee5\u76f4\u63a5\u7528\u52a0\u51cf\u4e58\u9664\u6765\u6253\u5370\u51fa\u76f8\u5bf9\u5e94\u6570\u91cf\u7684\u661f\u53f7\u5417\uff1f<br \/>\u611f\u8c22<\/p>\n<p>Problem 2:<br \/>Write a function that takes a list of numbers as parameters. Then print a histogram based on those numbers. Use asterisks to draw the histogram.<br \/>For example, given the list [3, 7, 9, 5]. The function should produce the following:<\/p>\n<p>***<br \/>*******<br \/>*********<br \/>*****<\/p>\n<p>Call the function with the list [3, 7, 9, 5].<br \/>Then call the function with the list [2, 0, 1].<\/p>\n<p>Hint: List was covered in the A3 notebook. We will formally discuss list in A5 notebook.<br \/>You might want to first write the histogram code without a function. Then after code is working, write the code with a function. Please submit only the code with a function.      <\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>5<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"3829511\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : learningman <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4ee3\u5199\u4f5c\u4e1a\uff0c50 \u4e00\u4f4d                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3829512\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : qefrgty <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u5148\u60f3\u529e\u6cd5\u53d6 list \u7684\u5143\u7d20\uff0c<\/p>\n<p>\u7136\u540e\u628a\u8fd9\u4e2a\u5143\u7d20\u8d4b\u503c\u7ed9\u4e00\u4e2a\u53d8\u91cf\uff0c<\/p>\n<p>\u7136\u540e\u6253\u5370\u53d8\u91cf\u4e2a\u661f\u53f7\u3002<\/p>\n<p>emmmm\u2026\u8fd9\u662f\u6700\u57fa\u672c\u7684\u601d\u8def\u4e86\u5427\u2026                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3829513\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : user8341 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4f5c\u4e1a\u8981\u81ea\u5df1\u505a\u554a\u3002\u4f60\u8fd9\u4e9b\u95ee\u9898\u7b80\u5355 Google \u4e00\u4e0b\u5c31\u6709\u89e3\u7b54\u7684\uff1a<\/p>\n<p>www.geeksforgeeks.org\/python-get-a-list-as-input-from-user\/<\/p>\n<p>www.w3resource.com\/python-exercises\/python-basic-exercise-26.php                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3829514\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : lambdafate <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             1. &#8220;Write a function that takes a list of numbers as parameters. &#8220;. \u4e0d\u9700\u8981 input \u5427\uff0clist \u4f5c\u4e3a\u51fd\u6570\u53c2\u6570\u4f20\u8fdb\u6765<br \/>2. \u53ef\u4ee5\u8fd9\u6837 &gt;&gt;&gt; &#8220;*&#8221; * n # n \u662f\u4e00\u4e2a\u6574\u6570                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3829515\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : gypsy <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @learningman <br \/>@qefrgty <br \/>@user8341 <br \/>@lambdafate <\/p>\n<p>\u505a\u5b8c\u4e86\uff0c\u8f93\u51fa\u662f\u5bf9\u7684\uff0c\u611f\u8c22\u3002<\/p>\n<p>import ast<br \/>list=ast.literal_eval(input())<\/p>\n<p>def star(a):<br \/> return &#8220;*&#8221; * a<\/p>\n<p>for i in list:<br \/> print(star(i))                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>\u5927\u4f6c\u4eec\uff0c\u4e00\u4e2a\u5173\u4e8e list \u7684\u4f5c\u4e1a&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\/169707"}],"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=169707"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/169707\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=169707"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=169707"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=169707"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}