{"id":3261,"date":"2023-04-06T17:35:20","date_gmt":"2023-04-06T09:35:20","guid":{"rendered":"http:\/\/cnliutz.ipyingshe.net\/?p=3261"},"modified":"2023-04-06T17:47:54","modified_gmt":"2023-04-06T09:47:54","slug":"%e7%8c%9c%e6%95%b0%e5%ad%97%e6%b8%b8%e6%88%8f","status":"publish","type":"post","link":"http:\/\/xnw60rlg.ipyingshe.net:5347\/?p=3261","title":{"rendered":"\u731c\u6570\u5b57\u6e38\u620f"},"content":{"rendered":"\n<pre class=\"wp-block-code\"><code>#\u731c\u6570\u5b57\u6e38\u620f\uff0c\u53ef\u91cd\u590d\u73a9\nimport random\ndef conjecture(): #\u731c\u6570\u5b57\u6e38\u620f\u7684\u51fd\u6570\n    answer = random.randint(1, 100)  #\u4ea7\u751f\u7684\u968f\u673a\u6570\u8303\u56f4\u5305\u62ec\u4e0b\u9650\u548c\u4e0a\u9650\n    print(answer)\n    counter = 0\n    print('\u8bf7\u731c\u4e00\u731c\u8fd9\u4e2a\u6574\u6570\uff081\u2014100\uff09\u662f\u591a\u5c11\uff1f')\n    while True:\n        counter += 1\n        number = int(input('\u8bf7\u8f93\u5165\uff1a'))\n        if number &lt; answer:\n            print('\u5927\u4e00\u70b9')\n        elif number &gt; answer:\n            print('\u5c0f\u4e00\u70b9')\n        else:\n            print('\u606d\u559c\u4f60\uff0c\u731c\u5bf9\u4e86\uff01')\n            print('\u4f60\u603b\u5171\u731c\u4e86%d\u6b21' % counter)\n            if counter &gt; 7:\n                print('\u4f60\u7684\u667a\u5546\u4f59\u989d\u660e\u663e\u4e0d\u8db3')\n            break\n    return counter\n\nwhile True: #\u53ef\u91cd\u590d\u73a9\n    conjecture()\n    again = input('\u518d\u73a9\u4e00\u6b21\uff1f\uff08yes\/no\uff09')\n    if again == 'yes':\n        continue\n    else:\n        break<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>#\u5de6\u4e0a\u4e09\u89d2\u4e58\u6cd5\u8868\r\nfor i in range(1, 10):\r\n    for j in range(1, 10-i+1):\r\n        print(' {}x {}= {}'.format(i, j, j*i), end='\\t')\r\n    print('\\n')\r\n\r\n#\u5de6\u4e0b\u4e09\u89d2\u4e58\u6cd5\u8868\r\nfor i in range(1, 10):\r\n    for j in range(1, i+1):\r\n        print(' {}x {}= {}'.format(i, j, i*j), end='\\t')\r\n    print('\\n')\r\n\r\n#\u53f3\u4e0a\u4e09\u89d2\u4e58\u6cd5\u8868\r\nfor i in range(1, 10):\r\n    for k in range(1, i):\r\n        print(end='\\t\\t')\r\n    for j in range(i, 10):\r\n        print(' {}x {}= {}'.format(i, j, j*i), end='\\t')\r\n    print('\\n')\r\n\r\n#\u53f3\u4e0b\u4e09\u89d2\u4e58\u6cd5\u8868\r\nfor i in range(1, 10):\r\n    for k in range(1, 10-i):\r\n        print(end='\\t\\t')\r\n    for j in range(10-i, 10):\r\n        print(' {}x {}= {}'.format(i, j+1, (j+1)*i), end='\\t')\r\n    print('\\n')<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10],"tags":[],"class_list":["post-3261","post","type-post","status-publish","format-standard","hentry","category-python"],"_links":{"self":[{"href":"http:\/\/xnw60rlg.ipyingshe.net:5347\/index.php?rest_route=\/wp\/v2\/posts\/3261","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/xnw60rlg.ipyingshe.net:5347\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/xnw60rlg.ipyingshe.net:5347\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/xnw60rlg.ipyingshe.net:5347\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/xnw60rlg.ipyingshe.net:5347\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3261"}],"version-history":[{"count":2,"href":"http:\/\/xnw60rlg.ipyingshe.net:5347\/index.php?rest_route=\/wp\/v2\/posts\/3261\/revisions"}],"predecessor-version":[{"id":3263,"href":"http:\/\/xnw60rlg.ipyingshe.net:5347\/index.php?rest_route=\/wp\/v2\/posts\/3261\/revisions\/3263"}],"wp:attachment":[{"href":"http:\/\/xnw60rlg.ipyingshe.net:5347\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3261"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/xnw60rlg.ipyingshe.net:5347\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3261"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/xnw60rlg.ipyingshe.net:5347\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3261"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}