{
  "type": "code_options",
  "author": "csdn.net",
  "source": "solution.md",
  "exercise_id": "0a3ddcde88eb4f6181853a678ebf45ea",
  "keywords": "算法初阶,基础知识,函数的增长,标准记号与常用函数",
  "title": "检查密码强度",
  "desc": [
    {
      "content": "\n<p>定义一个名为“isStrongPassword”的函数&#xff0c;该函数将字符串作为参数。功能然后将检查所提供的字符串是否满足以下条件&#xff0c;以检查是否为强 \n密码&#xff1a;\n1.必须至少包含1个大写和小写字母的组合\n2.必须至少包含3位数字\n3.必须至少包含3个特殊字符&#xff08;包括空格&#xff09;\n4.密码长度必须至少12个字符\n该函数将返回一个布尔值&#xff0c;即如果满足所有条件则返回True或返回False\n确保使用可能返回False值的每个可能的输入来测试函数也一样</p>",
      "language": "markdown"
    }
  ],
  "answer": [
    {
      "content": "",
      "language": "python"
    }
  ],
  "prepared": [
    [
      {
        "content": "",
        "language": "python"
      }
    ],
    [
      {
        "content": "",
        "language": "python"
      }
    ],
    [
      {
        "content": "",
        "language": "python"
      }
    ]
  ],
  "template": {
    "content": "def isStrongPassword(pwd):\n\tchars = list(pwd)\n\tupper = [c for c in chars if 'A' <= c and c <= 'Z']\n\tlower = [c for c in chars if 'a' <= c and c <= 'z']\n\tdigit = [c for c in chars if '0' <= c and c <= '9' ]\n\tsymbol = [c for c in chars if not ('A' <= c and c <= 'Z' or 'a' <= c and c <= 'z' or '0' <= c and c <= '9')] \n\tstrong = len(upper) >= 1 and len(lower) >= 1 and len(digit) >= 3 and len(symbol) >= 3 and len(pwd) >= 12\n\treturn strong\nprint(isStrongPassword(\"Str0n9P@$$w0rd\"))\nprint(isStrongPassword(\"StrongPassword\"))\nprint(isStrongPassword(\"Stron9P@$$0rd\"))\nprint(isStrongPassword(\"Str0n9Pass0rd\"))\nprint(isStrongPassword(\"str0n9p@$$0rd\"))\nprint(isStrongPassword(\"Str0n9P@$$\"))\nprint(isStrongPassword(\"12345678\"))\nprint(isStrongPassword(\"~!@#$$%^&*()_+\"))\nprint(isStrongPassword(\"STRONGPASSWORD\"))",
    "language": "python"
  },
  "node_id": "dailycode-2e6302bf718d46598da5024957c605a0",
  "license": "csdn.net",
  "created_at": 1637894161,
  "topic_link": "https://bbs.csdn.net/topics/600469891"
}