Skip to content

Commit 7433a29

Browse files
authored
Merge pull request darkprinx#47 from sophiexsun/master
updated a solution to question 18
2 parents 665c0da + 4f63ea5 commit 7433a29

File tree

1 file changed

+40
-1
lines changed

1 file changed

+40
-1
lines changed

notebooks/Day_06.ipynb

+40-1
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,45 @@
189189
"print(\",\".join(lst))"
190190
]
191191
},
192+
{
193+
"cell_type": "code",
194+
"execution_count": 1,
195+
"metadata": {},
196+
"outputs": [
197+
{
198+
"name": "stdin",
199+
"output_type": "stream",
200+
"text": [
201+
"please give me your passwords: ABd1234@1,a F1#,2w3E*,2We3345,Some@124\n"
202+
]
203+
},
204+
{
205+
"name": "stdout",
206+
"output_type": "stream",
207+
"text": [
208+
"ABd1234@1, Some@124\n"
209+
]
210+
}
211+
],
212+
"source": [
213+
"'''Solution by sophiexsun'''\n",
214+
"\n",
215+
"import re\n",
216+
"\n",
217+
"lower = re.compile(r'[a-z]')\n",
218+
"upper = re.compile(r'[A-Z]')\n",
219+
"digi = re.compile(r'[0-9]')\n",
220+
"schar = re.compile(r'[$#@]')\n",
221+
"\n",
222+
"def password_checker(password):\n",
223+
" if lower.search(password) and upper.search(password) and digi.search(password) and schar.search(password) and 6 <= len(password) <= 12:\n",
224+
" return password\n",
225+
"\n",
226+
"test_pwd = input(\"please give me your passwords:\").split(',')\n",
227+
"\n",
228+
"print(', '.join(filter(password_checker, test_pwd)))"
229+
]
230+
},
192231
{
193232
"cell_type": "markdown",
194233
"metadata": {},
@@ -276,7 +315,7 @@
276315
"name": "python",
277316
"nbconvert_exporter": "python",
278317
"pygments_lexer": "ipython3",
279-
"version": "3.7.6"
318+
"version": "3.8.5"
280319
}
281320
},
282321
"nbformat": 4,

0 commit comments

Comments
 (0)