{"id":184080,"date":"2022-04-13T13:41:05","date_gmt":"2022-04-13T05:41:05","guid":{"rendered":"http:\/\/www.idc.net\/help\/184080\/"},"modified":"2022-04-13T13:41:05","modified_gmt":"2022-04-13T05:41:05","slug":"python-%e7%a8%8b%e5%ba%8f%ef%bc%9a%e6%89%93%e5%8d%b0%e8%8c%83%e5%9b%b4%e5%86%85%e8%b4%9f%e6%95%b0","status":"publish","type":"post","link":"https:\/\/idc.net\/help\/184080\/","title":{"rendered":"Python \u7a0b\u5e8f\uff1a\u6253\u5370\u8303\u56f4\u5185\u8d1f\u6570"},"content":{"rendered":"<p>\u540e\u6d6a\u4e91Python\u6559\u7a0b\uff1a<\/p>\n<p>\u5199\u4e00\u4e2a Python \u7a0b\u5e8f\u6253\u5370\u4e00\u4e2a\u8303\u56f4\u5185\u7684\u8d1f\u6570\u3002\u8fd9\u4e2a Python \u793a\u4f8b\u5141\u8bb8\u5f00\u59cb\u548c\u7ed3\u675f\u6570\u5b57\uff0c\u5e76\u6253\u5370\u8be5\u8303\u56f4\u5185\u7684\u8d1f\u6570\u3002<\/p>\n<pre><code>minimum = int(input(\"Enter the Minimum Number = \"))\nmaximum = int(input(\"Enter the Maximum Number = \"))\n\nprint(\"\\nAll Negative Numbers from {0} and {1}\".format(minimum, maximum)) \nfor num in range(minimum, maximum + 1):\n    if num &lt; 0:\n        print(num, end = '   ')<\/code><\/pre>\n<\/p>\n<p>Python \u7a0b\u5e8f\uff0c\u4f7f\u7528 while \u5faa\u73af\u6253\u5370\u8303\u56f4\u4e3a 1 \u5230 n \u7684\u8d1f\u6570\u3002<\/p>\n<pre><code>minimum = int(input(\"Enter the Minimum Number = \"))\nmaximum = int(input(\"Enter the Maximum Number = \"))\n\nprint(\"\\nAll Negative Numbers from {0} and {1}\".format(minimum, maximum))\nwhile minimum &lt;= maximum:\n    if minimum &lt; 0:\n        print(minimum, end = '   ')\n    minimum = minimum + 1<\/code><\/pre>\n<pre><code>Enter the Minimum Number = -35\nEnter the Maximum Number = 400\n\nAll Negative Numbers from -35 and 400\n-35   -34   -33   -32   -31   -30   -29   -28   -27   -26   -25   -24   -23   -22   -21   -20   -19   -18   -17   -16   -15   -14   -13   -12   -11   -10   -9   -8   -7   -6   -5   -4   -3   -2   -1  <\/code><\/pre>\n<p>\u5728\u8fd9\u4e2a Python \u793a\u4f8b\u4e2d\uff0cnegativeNumbers \u51fd\u6570\u63a5\u53d7\u4e24\u4e2a\u6574\u6570\u5e76\u6253\u5370\u5b83\u4eec\u4e4b\u95f4\u7684\u8d1f\u6570\u3002<\/p>\n<pre><code>def negativeNumbers(x, y):\n    for num in range(x, y + 1):\n        if num &lt; 0:\n            print(num, end = '   ')\n\nminimum = int(input(\"Enter the Minimum Number = \"))\nmaximum = int(input(\"Enter the Maximum Number = \"))\n\nprint(\"\\nAll Negative Numbers from {0} and {1}\".format(minimum, maximum)) \nnegativeNumbers(minimum, maximum)<\/code><\/pre>\n<pre><code>Enter the Minimum Number = -25\nEnter the Maximum Number = 120\n\nAll Negative Numbers from -25 and 120\n-25   -24   -23   -22   -21   -20   -19   -18   -17   -16   -15   -14   -13   -12   -11   -10   -9   -8   -7   -6   -5   -4   -3   -2   -1 <\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u540e\u6d6a\u4e91Python\u6559\u7a0b\uff1a \u5199\u4e00\u4e2a Python \u7a0b\u5e8f\u6253\u5370\u4e00\u4e2a\u8303\u56f4\u5185\u7684\u8d1f\u6570\u3002\u8fd9\u4e2a Python \u793a\u4f8b\u5141\u8bb8\u5f00\u59cb\u548c\u7ed3 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[182397],"tags":[],"class_list":["post-184080","post","type-post","status-publish","format-standard","hentry","category-python"],"_links":{"self":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts\/184080","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/comments?post=184080"}],"version-history":[{"count":0,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts\/184080\/revisions"}],"wp:attachment":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/media?parent=184080"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/categories?post=184080"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/tags?post=184080"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}