{
  "type": "code_options",
  "author": "csdn.net",
  "source": "solution.md",
  "exercise_id": "380add44a3b646f9802a5e44575f5f9c",
  "keywords": "散列表,算法中阶,数据结构,散列函数",
  "title": "编写Python程序实现素数处理的功能",
  "desc": [
    {
      "content": "\n<p style=\"margin-left:0cm; margin-right:0cm\">编写Python程序实现素数处理的功能&#xff0c;要求如下&#xff1a;</p><p style=\"margin-left:0cm; margin-right:0cm\">&#xff08;1&#xff09;从键盘输入一个整数X&#xff0c;编写一个函数Find&#xff08;x&#61;100&#xff09;&#xff0c;找出1—X之间的所有的素数&#xff08;即质数&#xff09;&#xff0c;并将这些素数按照升序存放在列表 prime_list []中。</p><p style=\"margin-left:0cm; margin-right:0cm\">&#xff08;2&#xff09;在程序中编写一个函数delete_seven( prime_list)&#xff0c;将 prime_list []中个位含有7的素数删除&#xff1b;</p><p style=\"margin-left:0cm; margin-right:0cm\"><strong>【程序要求&#xff1a;】</strong></p><p style=\"margin-left:0cm; margin-right:0cm\">&#xff08;1&#xff09;有引导用户键盘输入的提示信息&#xff0c;言语要恰当&#xff1b;</p><p style=\"margin-left:0cm; margin-right:0cm\">&#xff08;2&#xff09;函数Find&#xff08;x&#61;100&#xff09;实现要正确&#xff0c;实现列表 prime_list []中查询到的素数的输出&#xff1b;</p><p style=\"margin-left:0cm; margin-right:0cm\">&#xff08;3&#xff09;函数delete_seven( prime_list)实现正确&#xff0c;输出删除指定素数后的相关数据信息。</p>",
      "language": "markdown"
    }
  ],
  "answer": [
    {
      "content": "",
      "language": "python"
    }
  ],
  "prepared": [
    [
      {
        "content": "",
        "language": "python"
      }
    ],
    [
      {
        "content": "",
        "language": "python"
      }
    ],
    [
      {
        "content": "",
        "language": "python"
      }
    ]
  ],
  "template": {
    "content": "def find(x=100):\n\tpl = []\n\tfor m in range(2,x+1):\n\t\tfor k in pl:\n\t\t\tif m % k == 0:\n\t\t\t\tbreak\n\t\telse:\n\t\t\tpl.append(m)\n\treturn pl\ndef delete_seven(pl):\n\treturn [x for x in pl if x%10!=7]\nx = int(input('输入一个整数:'))\nprime_list = find(x)\nprint(prime_list)\nprint(delete_seven(prime_list))",
    "language": "python"
  },
  "node_id": "dailycode-5d456f7d55404cf799b24bcc882a1553",
  "license": "csdn.net",
  "created_at": 1637894161,
  "topic_link": "https://bbs.csdn.net/topics/600470199"
}