Last active
July 6, 2022 00:11
-
-
Save brt-h/c4efe6bcf4d44c6a722568e997e57e16 to your computer and use it in GitHub Desktop.
12-31-21-python-challenges-from-edabit.ipynb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"nbformat": 4, | |
"nbformat_minor": 0, | |
"metadata": { | |
"colab": { | |
"name": "12-31-21-python-challenges-from-edabit.ipynb", | |
"provenance": [], | |
"collapsed_sections": [], | |
"authorship_tag": "ABX9TyPBeK3UbYEYJo1/cflIROGk", | |
"include_colab_link": true | |
}, | |
"kernelspec": { | |
"name": "python3", | |
"display_name": "Python 3" | |
}, | |
"language_info": { | |
"name": "python" | |
} | |
}, | |
"cells": [ | |
{ | |
"cell_type": "markdown", | |
"metadata": { | |
"id": "view-in-github", | |
"colab_type": "text" | |
}, | |
"source": [ | |
"<a href=\"https://colab.research.google.com/gist/brt-h/c4efe6bcf4d44c6a722568e997e57e16/12-31-21-python-challenges-from-edabit.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": { | |
"id": "ViL1uEFRZZ61" | |
}, | |
"outputs": [], | |
"source": [ | |
"# Stuttering Function https://edabit.com/challenge/gt9LLufDCMHKMioh2\n", | |
"def stutter(word):\n", | |
"\tx = \"{}... {}... {}?\".format(word[:2],word[:2],word)\n", | |
" # x = f\"{word[:2]}... {word[:2]}... {word}?\"\n", | |
"\treturn(x)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"source": [ | |
"# Find the Discount https://edabit.com/challenge/cXnkmRdxqJrwdsP4n\n", | |
"def dis(price, discount):\n", | |
"\tx = (price * (1-(discount/100)))\n", | |
"\tx = round(x,2)\n", | |
"\treturn(x)" | |
], | |
"metadata": { | |
"id": "aolggap4cTFX" | |
}, | |
"execution_count": null, | |
"outputs": [] | |
}, | |
{ | |
"cell_type": "code", | |
"source": [ | |
"# RegEx X-A: Word Character Class https://edabit.com/challenge/RYykpckz6nw5zBoLG\n", | |
"import re\n", | |
"pattern = \"\\w+\"" | |
], | |
"metadata": { | |
"id": "pp2Yqn68aKVV" | |
}, | |
"execution_count": null, | |
"outputs": [] | |
}, | |
{ | |
"cell_type": "code", | |
"source": [ | |
"# RegEx XV: Alternation https://edabit.com/challenge/9ZAHTYWTP5c7FW4RY\n", | |
"import re\n", | |
"pattern = \"red flag|blue flag\"" | |
], | |
"metadata": { | |
"id": "RQ0j4sd7hIHr" | |
}, | |
"execution_count": null, | |
"outputs": [] | |
}, | |
{ | |
"cell_type": "code", | |
"source": [ | |
"# RegEx XVIII: Fixed Quantifiers https://edabit.com/challenge/e9nBwAjkdMX9LQd4f\n", | |
"import re\n", | |
"pattern = \"\\.{3,}\"" | |
], | |
"metadata": { | |
"id": "DTwzZuHfjPTo" | |
}, | |
"execution_count": null, | |
"outputs": [] | |
}, | |
{ | |
"cell_type": "code", | |
"source": [ | |
"# RegEx XI-C: Whitespace Character Class https://edabit.com/challenge/8jwMviqNvedEmyBic\n", | |
"import re\n", | |
"pattern = \"\\S\\?$\"" | |
], | |
"metadata": { | |
"id": "YfftoJemnsYb" | |
}, | |
"execution_count": null, | |
"outputs": [] | |
}, | |
{ | |
"cell_type": "code", | |
"source": [ | |
"# RegEx II: Line Anchors https://edabit.com/challenge/Rvxp6owt97Tq7Qr9t\n", | |
"import re\n", | |
"pattern = \"^/users/edabit/\"" | |
], | |
"metadata": { | |
"id": "oL1_NLJVM_Sx" | |
}, | |
"execution_count": null, | |
"outputs": [] | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment