{
  "type": "code_options",
  "author": "csdn.net",
  "source": "solution.md",
  "exercise_id": "92020885fd7041279222c4dfd3ac8a17",
  "keywords": "算法高阶,数论算法,算法问题选编,整数的因子分解",
  "title": "计算出因子里面4和7的个数",
  "desc": [
    {
      "content": "\n<p>输入一个正数n&#xff0c;计算出因子里面分别有几个4和7&#xff0c;输出因子中4和7的个位数</p>",
      "language": "markdown"
    }
  ],
  "answer": [
    {
      "content": "",
      "language": "python"
    }
  ],
  "prepared": [
    [
      {
        "content": "",
        "language": "python"
      }
    ],
    [
      {
        "content": "",
        "language": "python"
      }
    ],
    [
      {
        "content": "",
        "language": "python"
      }
    ]
  ],
  "template": {
    "content": "n = int(input(\"输入数字：\"))\nfactor = [n]   \nnum = 1\nwhile num <= n/2+1:\n\tif n % num == 0:\n\t\tfactor.append(num)\n\tnum = num + 1\nprint(factor)\nm = [str(i) for i in factor]\ncount4 = 0\ncount7 = 0\nfor i in m:\n\tif '4' in i:\n\t\tcount4 += 1\n\t\tprint('以4结尾的因子的个位数：', int(i)%10)\n\tif '7' in i:\n\t\tcount7 += 1\n\t\tprint('以7结尾的因子的个位数：', int(i)%10)\nprint('因子里面分别有{0}个4和{1}个7'.format(count4,count7))",
    "language": "python"
  },
  "node_id": "dailycode-d23a2d27d45a49b197d1cd6eea72f56a",
  "license": "csdn.net",
  "created_at": 1637894161,
  "topic_link": "https://bbs.csdn.net/topics/600470505"
}