|
189 | 189 | "print(\",\".join(lst))" |
190 | 190 | ] |
191 | 191 | }, |
| 192 | + { |
| 193 | + "cell_type": "markdown", |
| 194 | + "metadata": {}, |
| 195 | + "source": [ |
| 196 | + "### Here is another solution for Ques 18(by Vikranttyagi95)" |
| 197 | + ] |
| 198 | + }, |
| 199 | + { |
| 200 | + "cell_type": "code", |
| 201 | + "execution_count": null, |
| 202 | + "metadata": {}, |
| 203 | + "outputs": [], |
| 204 | + "source": [ |
| 205 | + "import string\n", |
| 206 | + "\n", |
| 207 | + "passwords = input(\"Please enter passwords: \").split(',')\n", |
| 208 | + "\n", |
| 209 | + "def char_cond(password):\n", |
| 210 | + " return any(char in password for char in string.ascii_lowercase)\n", |
| 211 | + "\n", |
| 212 | + "def digit_cond(password):\n", |
| 213 | + " return any(char in password for char in string.digits)\n", |
| 214 | + "\n", |
| 215 | + "def special_cond(password):\n", |
| 216 | + " return any(char in password for char in \"$#@\")\n", |
| 217 | + "\n", |
| 218 | + "for password in passwords:\n", |
| 219 | + " if 6 <= len(password) <=12 and char_cond(password) and digit_cond(password) and special_cond(password):\n", |
| 220 | + " print(password) " |
| 221 | + ] |
| 222 | + }, |
192 | 223 | { |
193 | 224 | "cell_type": "markdown", |
194 | 225 | "metadata": {}, |
|
262 | 293 | ], |
263 | 294 | "metadata": { |
264 | 295 | "kernelspec": { |
265 | | - "display_name": "Python 3", |
| 296 | + "display_name": "Python 3 (ipykernel)", |
266 | 297 | "language": "python", |
267 | 298 | "name": "python3" |
268 | 299 | }, |
|
276 | 307 | "name": "python", |
277 | 308 | "nbconvert_exporter": "python", |
278 | 309 | "pygments_lexer": "ipython3", |
279 | | - "version": "3.7.6" |
| 310 | + "version": "3.9.5" |
| 311 | + }, |
| 312 | + "toc": { |
| 313 | + "base_numbering": 1, |
| 314 | + "nav_menu": {}, |
| 315 | + "number_sections": true, |
| 316 | + "sideBar": true, |
| 317 | + "skip_h1_title": false, |
| 318 | + "title_cell": "Table of Contents", |
| 319 | + "title_sidebar": "Contents", |
| 320 | + "toc_cell": false, |
| 321 | + "toc_position": {}, |
| 322 | + "toc_section_display": true, |
| 323 | + "toc_window_display": false |
280 | 324 | } |
281 | 325 | }, |
282 | 326 | "nbformat": 4, |
|
0 commit comments