From 426dbf6a5e204f48b66ebcb194dbe353a9c1b69c Mon Sep 17 00:00:00 2001 From: gopik820 Date: Sat, 9 Jan 2021 19:27:42 +0530 Subject: [PATCH 1/9] Step 1 --- Python-ifed.ipynb | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/Python-ifed.ipynb b/Python-ifed.ipynb index ee9444d..6b05716 100644 --- a/Python-ifed.ipynb +++ b/Python-ifed.ipynb @@ -62,15 +62,15 @@ "### Describe what each of the following means\n", "\n", "#### Production\n", - "(Insert answer here)\n", + "The final code that is provided to the client or the public after multiple development and undergoing multiple test by the testers , is known as the production code. \n", "#### Clean \n", - "(Insert answer here)\n", + "A clean code is the code which is more visually appealing and understandable.A clean code is important as it facilitates several features which enables us to make easier maintainence, save time in the long run and also helps easier debugging.\n", "#### Modular\n", - "(Insert answer here)\n", + "The code which can be divided to several independent,interchangeable modules which are used to perform a part of the function of the entire code.\n", "#### Module\n", - "(Insert answer here)\n", + "The independent blocks of code which together forms a program is called a module.\n", "#### Refactoring code\n", - "(Insert answer here)" + "Refactoring code is the process of restructuring the existing code, that is changing the factor without making any changes to the logic of the code" ] }, { @@ -113,9 +113,21 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 1, "metadata": {}, - "outputs": [], + "outputs": [ + { + "output_type": "error", + "ename": "NameError", + "evalue": "name 'df' is not defined", + "traceback": [ + "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[1;31mNameError\u001b[0m Traceback (most recent call last)", + "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m new_df = df.rename(columns={'team 1': 'team_1',\n\u001b[0m\u001b[0;32m 2\u001b[0m \u001b[1;34m'team 2'\u001b[0m\u001b[1;33m:\u001b[0m \u001b[1;34m'team_2'\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 3\u001b[0m \u001b[1;34m'toss winner'\u001b[0m\u001b[1;33m:\u001b[0m \u001b[1;34m'toss_winner'\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 4\u001b[0m \u001b[1;34m'dl applied'\u001b[0m\u001b[1;33m:\u001b[0m \u001b[1;34m'dl_applied'\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 5\u001b[0m \u001b[1;34m'win by runs'\u001b[0m\u001b[1;33m:\u001b[0m \u001b[1;34m'win_by_runs'\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", + "\u001b[1;31mNameError\u001b[0m: name 'df' is not defined" + ] + } + ], "source": [ "new_df = df.rename(columns={'team 1': 'team_1',\n", " 'team 2': 'team_2',\n", @@ -515,7 +527,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.6.9" + "version": "3.8.5-final" } }, "nbformat": 4, From 8d8e019608103a1dfe9aa4853a4f034501106dde Mon Sep 17 00:00:00 2001 From: gopik820 Date: Sat, 9 Jan 2021 19:51:55 +0530 Subject: [PATCH 2/9] step 2 complete --- Python-ifed.ipynb | 224 ++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 207 insertions(+), 17 deletions(-) diff --git a/Python-ifed.ipynb b/Python-ifed.ipynb index 6b05716..7e51151 100644 --- a/Python-ifed.ipynb +++ b/Python-ifed.ipynb @@ -93,9 +93,59 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 2, "metadata": {}, - "outputs": [], + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + " Season city date team 1 \\\n", + "id \n", + "1 IPL-2017 Hyderabad 05-04-2017 Sunrisers Hyderabad \n", + "2 IPL-2017 Pune 06-04-2017 Mumbai Indians \n", + "3 IPL-2017 Rajkot 07-04-2017 Gujarat Lions \n", + "4 IPL-2017 Indore 08-04-2017 Rising Pune Supergiant \n", + "5 IPL-2017 Bangalore 08-04-2017 Royal Challengers Bangalore \n", + "\n", + " team 2 toss winner toss decision \\\n", + "id \n", + "1 Royal Challengers Bangalore Royal Challengers Bangalore field \n", + "2 Rising Pune Supergiant Rising Pune Supergiant field \n", + "3 Kolkata Knight Riders Kolkata Knight Riders field \n", + "4 Kings XI Punjab Kings XI Punjab field \n", + "5 Delhi Daredevils Royal Challengers Bangalore bat \n", + "\n", + " result dl applied winner win by runs \\\n", + "id \n", + "1 normal 0 Sunrisers Hyderabad 35 \n", + "2 normal 0 Rising Pune Supergiant 0 \n", + "3 normal 0 Kolkata Knight Riders 0 \n", + "4 normal 0 Kings XI Punjab 0 \n", + "5 normal 0 Royal Challengers Bangalore 15 \n", + "\n", + " win by wickets player of match venue \\\n", + "id \n", + "1 0 Yuvraj Singh Rajiv Gandhi International Stadium, Uppal \n", + "2 7 SPD Smith Maharashtra Cricket Association Stadium \n", + "3 10 CA Lynn Saurashtra Cricket Association Stadium \n", + "4 6 GJ Maxwell Holkar Cricket Stadium \n", + "5 0 KM Jadhav M Chinnaswamy Stadium \n", + "\n", + " umpire 1 umpire 2 \n", + "id \n", + "1 AY Dandekar NJ Llong \n", + "2 A Nand Kishore S Ravi \n", + "3 Nitin Menon CK Nandan \n", + "4 AK Chaudhary C Shamshuddin \n", + "5 NaN NaN " + ], + "text/html": "
\n\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
Seasoncitydateteam 1team 2toss winnertoss decisionresultdl appliedwinnerwin by runswin by wicketsplayer of matchvenueumpire 1umpire 2
id
1IPL-2017Hyderabad05-04-2017Sunrisers HyderabadRoyal Challengers BangaloreRoyal Challengers Bangalorefieldnormal0Sunrisers Hyderabad350Yuvraj SinghRajiv Gandhi International Stadium, UppalAY DandekarNJ Llong
2IPL-2017Pune06-04-2017Mumbai IndiansRising Pune SupergiantRising Pune Supergiantfieldnormal0Rising Pune Supergiant07SPD SmithMaharashtra Cricket Association StadiumA Nand KishoreS Ravi
3IPL-2017Rajkot07-04-2017Gujarat LionsKolkata Knight RidersKolkata Knight Ridersfieldnormal0Kolkata Knight Riders010CA LynnSaurashtra Cricket Association StadiumNitin MenonCK Nandan
4IPL-2017Indore08-04-2017Rising Pune SupergiantKings XI PunjabKings XI Punjabfieldnormal0Kings XI Punjab06GJ MaxwellHolkar Cricket StadiumAK ChaudharyC Shamshuddin
5IPL-2017Bangalore08-04-2017Royal Challengers BangaloreDelhi DaredevilsRoyal Challengers Bangalorebatnormal0Royal Challengers Bangalore150KM JadhavM Chinnaswamy StadiumNaNNaN
\n
" + }, + "metadata": {}, + "execution_count": 2 + } + ], "source": [ "import pandas as pd\n", "df = pd.read_csv('matches.csv', sep=',')\n", @@ -113,19 +163,57 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": 3, "metadata": {}, "outputs": [ { - "output_type": "error", - "ename": "NameError", - "evalue": "name 'df' is not defined", - "traceback": [ - "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[1;31mNameError\u001b[0m Traceback (most recent call last)", - "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m new_df = df.rename(columns={'team 1': 'team_1',\n\u001b[0m\u001b[0;32m 2\u001b[0m \u001b[1;34m'team 2'\u001b[0m\u001b[1;33m:\u001b[0m \u001b[1;34m'team_2'\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 3\u001b[0m \u001b[1;34m'toss winner'\u001b[0m\u001b[1;33m:\u001b[0m \u001b[1;34m'toss_winner'\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 4\u001b[0m \u001b[1;34m'dl applied'\u001b[0m\u001b[1;33m:\u001b[0m \u001b[1;34m'dl_applied'\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 5\u001b[0m \u001b[1;34m'win by runs'\u001b[0m\u001b[1;33m:\u001b[0m \u001b[1;34m'win_by_runs'\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", - "\u001b[1;31mNameError\u001b[0m: name 'df' is not defined" - ] + "output_type": "execute_result", + "data": { + "text/plain": [ + " Season city date team_1 \\\n", + "id \n", + "1 IPL-2017 Hyderabad 05-04-2017 Sunrisers Hyderabad \n", + "2 IPL-2017 Pune 06-04-2017 Mumbai Indians \n", + "3 IPL-2017 Rajkot 07-04-2017 Gujarat Lions \n", + "4 IPL-2017 Indore 08-04-2017 Rising Pune Supergiant \n", + "5 IPL-2017 Bangalore 08-04-2017 Royal Challengers Bangalore \n", + "\n", + " team_2 toss_winner toss decision \\\n", + "id \n", + "1 Royal Challengers Bangalore Royal Challengers Bangalore field \n", + "2 Rising Pune Supergiant Rising Pune Supergiant field \n", + "3 Kolkata Knight Riders Kolkata Knight Riders field \n", + "4 Kings XI Punjab Kings XI Punjab field \n", + "5 Delhi Daredevils Royal Challengers Bangalore bat \n", + "\n", + " result dl_applied winner win_by_runs \\\n", + "id \n", + "1 normal 0 Sunrisers Hyderabad 35 \n", + "2 normal 0 Rising Pune Supergiant 0 \n", + "3 normal 0 Kolkata Knight Riders 0 \n", + "4 normal 0 Kings XI Punjab 0 \n", + "5 normal 0 Royal Challengers Bangalore 15 \n", + "\n", + " win_by_wickets player_of_match venue \\\n", + "id \n", + "1 0 Yuvraj Singh Rajiv Gandhi International Stadium, Uppal \n", + "2 7 SPD Smith Maharashtra Cricket Association Stadium \n", + "3 10 CA Lynn Saurashtra Cricket Association Stadium \n", + "4 6 GJ Maxwell Holkar Cricket Stadium \n", + "5 0 KM Jadhav M Chinnaswamy Stadium \n", + "\n", + " umpire_1 umpire_2 \n", + "id \n", + "1 AY Dandekar NJ Llong \n", + "2 A Nand Kishore S Ravi \n", + "3 Nitin Menon CK Nandan \n", + "4 AK Chaudhary C Shamshuddin \n", + "5 NaN NaN " + ], + "text/html": "
\n\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
Seasoncitydateteam_1team_2toss_winnertoss decisionresultdl_appliedwinnerwin_by_runswin_by_wicketsplayer_of_matchvenueumpire_1umpire_2
id
1IPL-2017Hyderabad05-04-2017Sunrisers HyderabadRoyal Challengers BangaloreRoyal Challengers Bangalorefieldnormal0Sunrisers Hyderabad350Yuvraj SinghRajiv Gandhi International Stadium, UppalAY DandekarNJ Llong
2IPL-2017Pune06-04-2017Mumbai IndiansRising Pune SupergiantRising Pune Supergiantfieldnormal0Rising Pune Supergiant07SPD SmithMaharashtra Cricket Association StadiumA Nand KishoreS Ravi
3IPL-2017Rajkot07-04-2017Gujarat LionsKolkata Knight RidersKolkata Knight Ridersfieldnormal0Kolkata Knight Riders010CA LynnSaurashtra Cricket Association StadiumNitin MenonCK Nandan
4IPL-2017Indore08-04-2017Rising Pune SupergiantKings XI PunjabKings XI Punjabfieldnormal0Kings XI Punjab06GJ MaxwellHolkar Cricket StadiumAK ChaudharyC Shamshuddin
5IPL-2017Bangalore08-04-2017Royal Challengers BangaloreDelhi DaredevilsRoyal Challengers Bangalorebatnormal0Royal Challengers Bangalore150KM JadhavM Chinnaswamy StadiumNaNNaN
\n
" + }, + "metadata": {}, + "execution_count": 3 } ], "source": [ @@ -151,9 +239,59 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 4, "metadata": {}, - "outputs": [], + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + " Season city date team_1 \\\n", + "id \n", + "1 IPL-2017 Hyderabad 05-04-2017 Sunrisers Hyderabad \n", + "2 IPL-2017 Pune 06-04-2017 Mumbai Indians \n", + "3 IPL-2017 Rajkot 07-04-2017 Gujarat Lions \n", + "4 IPL-2017 Indore 08-04-2017 Rising Pune Supergiant \n", + "5 IPL-2017 Bangalore 08-04-2017 Royal Challengers Bangalore \n", + "\n", + " team 2 toss_winner toss_decision \\\n", + "id \n", + "1 Royal Challengers Bangalore Royal Challengers Bangalore field \n", + "2 Rising Pune Supergiant Rising Pune Supergiant field \n", + "3 Kolkata Knight Riders Kolkata Knight Riders field \n", + "4 Kings XI Punjab Kings XI Punjab field \n", + "5 Delhi Daredevils Royal Challengers Bangalore bat \n", + "\n", + " result dl_applied winner win_by_runs \\\n", + "id \n", + "1 normal 0 Sunrisers Hyderabad 35 \n", + "2 normal 0 Rising Pune Supergiant 0 \n", + "3 normal 0 Kolkata Knight Riders 0 \n", + "4 normal 0 Kings XI Punjab 0 \n", + "5 normal 0 Royal Challengers Bangalore 15 \n", + "\n", + " win by wickets player of match venue \\\n", + "id \n", + "1 0 Yuvraj Singh Rajiv Gandhi International Stadium, Uppal \n", + "2 7 SPD Smith Maharashtra Cricket Association Stadium \n", + "3 10 CA Lynn Saurashtra Cricket Association Stadium \n", + "4 6 GJ Maxwell Holkar Cricket Stadium \n", + "5 0 KM Jadhav M Chinnaswamy Stadium \n", + "\n", + " umpire 1 umpire 2 \n", + "id \n", + "1 AY Dandekar NJ Llong \n", + "2 A Nand Kishore S Ravi \n", + "3 Nitin Menon CK Nandan \n", + "4 AK Chaudhary C Shamshuddin \n", + "5 NaN NaN " + ], + "text/html": "
\n\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
Seasoncitydateteam_1team 2toss_winnertoss_decisionresultdl_appliedwinnerwin_by_runswin by wicketsplayer of matchvenueumpire 1umpire 2
id
1IPL-2017Hyderabad05-04-2017Sunrisers HyderabadRoyal Challengers BangaloreRoyal Challengers Bangalorefieldnormal0Sunrisers Hyderabad350Yuvraj SinghRajiv Gandhi International Stadium, UppalAY DandekarNJ Llong
2IPL-2017Pune06-04-2017Mumbai IndiansRising Pune SupergiantRising Pune Supergiantfieldnormal0Rising Pune Supergiant07SPD SmithMaharashtra Cricket Association StadiumA Nand KishoreS Ravi
3IPL-2017Rajkot07-04-2017Gujarat LionsKolkata Knight RidersKolkata Knight Ridersfieldnormal0Kolkata Knight Riders010CA LynnSaurashtra Cricket Association StadiumNitin MenonCK Nandan
4IPL-2017Indore08-04-2017Rising Pune SupergiantKings XI PunjabKings XI Punjabfieldnormal0Kings XI Punjab06GJ MaxwellHolkar Cricket StadiumAK ChaudharyC Shamshuddin
5IPL-2017Bangalore08-04-2017Royal Challengers BangaloreDelhi DaredevilsRoyal Challengers Bangalorebatnormal0Royal Challengers Bangalore150KM JadhavM Chinnaswamy StadiumNaNNaN
\n
" + }, + "metadata": {}, + "execution_count": 4 + } + ], "source": [ "labels = list(df.columns)\n", "labels[0] = labels[0].replace(' ', '_')\n", @@ -179,11 +317,63 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 7, "metadata": {}, - "outputs": [], + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + " Season city date team_1 \\\n", + "id \n", + "1 IPL-2017 Hyderabad 05-04-2017 Sunrisers Hyderabad \n", + "2 IPL-2017 Pune 06-04-2017 Mumbai Indians \n", + "3 IPL-2017 Rajkot 07-04-2017 Gujarat Lions \n", + "4 IPL-2017 Indore 08-04-2017 Rising Pune Supergiant \n", + "5 IPL-2017 Bangalore 08-04-2017 Royal Challengers Bangalore \n", + "\n", + " team_2 toss_winner toss_decision \\\n", + "id \n", + "1 Royal Challengers Bangalore Royal Challengers Bangalore field \n", + "2 Rising Pune Supergiant Rising Pune Supergiant field \n", + "3 Kolkata Knight Riders Kolkata Knight Riders field \n", + "4 Kings XI Punjab Kings XI Punjab field \n", + "5 Delhi Daredevils Royal Challengers Bangalore bat \n", + "\n", + " result dl_applied winner win_by_runs \\\n", + "id \n", + "1 normal 0 Sunrisers Hyderabad 35 \n", + "2 normal 0 Rising Pune Supergiant 0 \n", + "3 normal 0 Kolkata Knight Riders 0 \n", + "4 normal 0 Kings XI Punjab 0 \n", + "5 normal 0 Royal Challengers Bangalore 15 \n", + "\n", + " win_by_wickets player_of_match venue \\\n", + "id \n", + "1 0 Yuvraj Singh Rajiv Gandhi International Stadium, Uppal \n", + "2 7 SPD Smith Maharashtra Cricket Association Stadium \n", + "3 10 CA Lynn Saurashtra Cricket Association Stadium \n", + "4 6 GJ Maxwell Holkar Cricket Stadium \n", + "5 0 KM Jadhav M Chinnaswamy Stadium \n", + "\n", + " umpire_1 umpire_2 \n", + "id \n", + "1 AY Dandekar NJ Llong \n", + "2 A Nand Kishore S Ravi \n", + "3 Nitin Menon CK Nandan \n", + "4 AK Chaudhary C Shamshuddin \n", + "5 NaN NaN " + ], + "text/html": "
\n\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
Seasoncitydateteam_1team_2toss_winnertoss_decisionresultdl_appliedwinnerwin_by_runswin_by_wicketsplayer_of_matchvenueumpire_1umpire_2
id
1IPL-2017Hyderabad05-04-2017Sunrisers HyderabadRoyal Challengers BangaloreRoyal Challengers Bangalorefieldnormal0Sunrisers Hyderabad350Yuvraj SinghRajiv Gandhi International Stadium, UppalAY DandekarNJ Llong
2IPL-2017Pune06-04-2017Mumbai IndiansRising Pune SupergiantRising Pune Supergiantfieldnormal0Rising Pune Supergiant07SPD SmithMaharashtra Cricket Association StadiumA Nand KishoreS Ravi
3IPL-2017Rajkot07-04-2017Gujarat LionsKolkata Knight RidersKolkata Knight Ridersfieldnormal0Kolkata Knight Riders010CA LynnSaurashtra Cricket Association StadiumNitin MenonCK Nandan
4IPL-2017Indore08-04-2017Rising Pune SupergiantKings XI PunjabKings XI Punjabfieldnormal0Kings XI Punjab06GJ MaxwellHolkar Cricket StadiumAK ChaudharyC Shamshuddin
5IPL-2017Bangalore08-04-2017Royal Challengers BangaloreDelhi DaredevilsRoyal Challengers Bangalorebatnormal0Royal Challengers Bangalore150KM JadhavM Chinnaswamy StadiumNaNNaN
\n
" + }, + "metadata": {}, + "execution_count": 7 + } + ], "source": [ - "# Insert your solution here" + "new_df=df\n", + "new_df.columns = df.columns.str.replace(' ','_')\n", + "new_df.head()" ] }, { From 86a5997a7b70ef0ad3397ff56a5a24a50b713a8e Mon Sep 17 00:00:00 2001 From: gopik820 Date: Sat, 9 Jan 2021 20:59:55 +0530 Subject: [PATCH 3/9] step 3 complete --- Python-ifed.ipynb | 50 +++++++++++++++++++++++++++++++++++++---------- 1 file changed, 40 insertions(+), 10 deletions(-) diff --git a/Python-ifed.ipynb b/Python-ifed.ipynb index 7e51151..21f2944 100644 --- a/Python-ifed.ipynb +++ b/Python-ifed.ipynb @@ -410,7 +410,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 8, "metadata": {}, "outputs": [], "source": [ @@ -421,7 +421,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 9, "metadata": {}, "outputs": [], "source": [ @@ -435,9 +435,17 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 18, "metadata": {}, - "outputs": [], + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "96\nDuration: 9.67475152015686 seconds\n" + ] + } + ], "source": [ "start = time.time()\n", "verified_elements = []\n", @@ -459,11 +467,22 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 55, "metadata": {}, - "outputs": [], + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "96\nDuration: 0.02094292640686035 seconds\n" + ] + } + ], "source": [ - "# Insert answer here\n", + "start=time.time()\n", + "verified_elements = []\n", + "\n", + "verified_elements=np.intersect1d(subset_elements,all_elements)\n", "\n", "print(len(verified_elements))\n", "print('Duration: {} seconds'.format(time.time() - start))" @@ -478,11 +497,22 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 62, "metadata": {}, - "outputs": [], + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "96\nDuration: 0.006979465484619141 seconds\n" + ] + } + ], "source": [ - "# Insert answer here\n", + "start=time.time()\n", + "verified_elements = []\n", + "\n", + "verified_elements=list(set(all_elements)&set(subset_elements))\n", "\n", "print(len(verified_elements))\n", "print('Duration: {} seconds'.format(time.time() - start))" From 3104815982d4d0713d3dd5c9f7a02f9c45a05697 Mon Sep 17 00:00:00 2001 From: gopik820 Date: Sat, 9 Jan 2021 23:15:20 +0530 Subject: [PATCH 4/9] step 4 complete --- Python-ifed.ipynb | 48 +++++++++++---- ...test_abilities.cpython-39-pytest-6.2.1.pyc | Bin 0 -> 1924 bytes ...nearest_square.cpython-38-pytest-6.1.1.pyc | Bin 0 -> 2034 bytes ...nearest_square.cpython-39-pytest-6.2.1.pyc | Bin 0 -> 1968 bytes step_4.py | 56 ++++++++++++++++++ subset_elemets.txt => subset_elements.txt | 0 tempCodeRunnerFile.py | 1 + 7 files changed, 94 insertions(+), 11 deletions(-) create mode 100644 __pycache__/test_abilities.cpython-39-pytest-6.2.1.pyc create mode 100644 __pycache__/test_nearest_square.cpython-38-pytest-6.1.1.pyc create mode 100644 __pycache__/test_nearest_square.cpython-39-pytest-6.2.1.pyc create mode 100644 step_4.py rename subset_elemets.txt => subset_elements.txt (100%) create mode 100644 tempCodeRunnerFile.py diff --git a/Python-ifed.ipynb b/Python-ifed.ipynb index 21f2944..6920c9b 100644 --- a/Python-ifed.ipynb +++ b/Python-ifed.ipynb @@ -410,7 +410,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 7, "metadata": {}, "outputs": [], "source": [ @@ -421,11 +421,11 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 8, "metadata": {}, "outputs": [], "source": [ - "with open('subset_elemets.txt') as f:\n", + "with open('subset_elements.txt') as f:\n", " subset_elements = f.read().split('\\n')\n", " \n", "with open('all_elements.txt') as f:\n", @@ -435,14 +435,14 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": 9, "metadata": {}, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ - "96\nDuration: 9.67475152015686 seconds\n" + "96\nDuration: 9.655861854553223 seconds\n" ] } ], @@ -467,14 +467,14 @@ }, { "cell_type": "code", - "execution_count": 55, + "execution_count": 10, "metadata": {}, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ - "96\nDuration: 0.02094292640686035 seconds\n" + "96\nDuration: 0.026705026626586914 seconds\n" ] } ], @@ -497,14 +497,14 @@ }, { "cell_type": "code", - "execution_count": 62, + "execution_count": 11, "metadata": {}, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ - "96\nDuration: 0.006979465484619141 seconds\n" + "96\nDuration: 0.009980916976928711 seconds\n" ] } ], @@ -562,9 +562,35 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 12, "metadata": {}, - "outputs": [], + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "============================= test session starts =============================\n", + "platform win32 -- Python 3.8.5, pytest-6.1.1, py-1.9.0, pluggy-0.13.1\n", + "rootdir: c:\\Users\\gopil\\Desktop\\Python-ifed-challenge\n", + "collected 0 items / 1 error\n", + "\n", + "=================================== ERRORS ====================================\n", + "___________________ ERROR collecting test_nearest_square.py ___________________\n", + "ImportError while importing test module 'c:\\Users\\gopil\\Desktop\\Python-ifed-challenge\\test_nearest_square.py'.\n", + "Hint: make sure your test modules/packages have valid Python names.\n", + "Traceback:\n", + "..\\..\\anaconda3\\lib\\importlib\\__init__.py:127: in import_module\n", + " return _bootstrap._gcd_import(name[level:], package, level)\n", + "test_nearest_square.py:1: in \n", + " from nearest_square import nearest_square\n", + "E ModuleNotFoundError: No module named 'nearest_square'\n", + "=========================== short test summary info ===========================\n", + "ERROR test_nearest_square.py\n", + "!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!\n", + "============================== 1 error in 0.10s ===============================\n" + ] + } + ], "source": [ "! pytest test_nearest_square.py" ] diff --git a/__pycache__/test_abilities.cpython-39-pytest-6.2.1.pyc b/__pycache__/test_abilities.cpython-39-pytest-6.2.1.pyc new file mode 100644 index 0000000000000000000000000000000000000000..231cf16350a4420ab3fa19f08d01f8aefe6e2262 GIT binary patch literal 1924 zcmds2%Wm676rJHqr2GJqIBv4@riHnXVJB(R6m^gw>81;#K-&!=fEa5=6yf0mGb6iF zq)pQg$Oi;P6m+9azbD`}tA0Yg>b<0F$VGz0UIigB_cgS5sQ@xW+7djd`W1%lHlF=RrX($hgNPuKiCtnYfTs0no;h( zbT-MFVyX43u9}43$5KyZ==2w>aacC+Ha!wL#^;W z=1ye87!-F<+(U8ybe(A}l&L3p5b6qo59UGrMb&;(j*QSIW~#at_n4Hi5~b=DS;>^B zR-rpS9H!Ewxvo4}zzAL4iuIrvN?s3*6ImQG8Rsk$RS;{|7dS(;{E%G0fDpYkN z?iVU!CKkVylI6@m&)kbvaD`@rd&|z3y_cA+1u=adT!NTwAZD2!0X2t_rwv?6Z@ebc zWMJ|%PdcjL3Qw(E6nJ!n38*jwm5(AoaUBKX-iQsb{)gaV4gB~F!A-C~4+H~Xl1j&z z%I=|LV=-RQg=DHz7AHbo6~N646g*!70Y8KAi%UWHDOX2Vh+`o_d+e)W-eD(f6s!gJ4&3W)IhO2 x4^^#2OyN(nNffLQ3Q4Z;niS5ylp}Sv)QRGMpA~#4#Y6bZ5{*gqmF3&`{s*Qh-$DQY literal 0 HcmV?d00001 diff --git a/__pycache__/test_nearest_square.cpython-38-pytest-6.1.1.pyc b/__pycache__/test_nearest_square.cpython-38-pytest-6.1.1.pyc new file mode 100644 index 0000000000000000000000000000000000000000..16010bab30f1a6b23458ad1d99bcb5237faff360 GIT binary patch literal 2034 zcmd6oL2uhO6o5&Jl4U#b)^1IkZ5Rv`1*$`W*iD+GScVSSb{K}Bz|b5F1A=PGi4j>+ zNd>Jl>9Y2?)6P4@NAIxTGw8aLf5LLwdz2k0skzMPJIgNkpqY3jnMa`uM$_iJO!nP_W5IhQh~M)O`U@fG$RQ~$s3wc!7`T8 zl%255NDcLKLeH51txp9VZV&8U@Q_Grrg>~Ce62m^>xdC%fv^yX+QEXo{Jf(b@=mmBi zh3?%+Rlkwfp2njDW9iBKmfQ1!z?FV1d(kk4(B@0vc3+$hf@Bb?+zKL?q4ImKI*v{Q zp{Ke>LG;24+|V2PdDT^3-^Ug5##j2QgDCt)%1GuPx&25Ey~Ooj$AK4m33w(}UdJyK z8*G&akII9`ozk?eVoyF7|s*y3gUzs(Td0gP{AhuTGLE?minO z$5FU8==)-=cMPZX!y~_|18^0p^>~!uSzvd!3|L>?20Fn4BPI$Tz9l^O_S zatp=I*#{*sTYz?l$D`JUT*hxzD0#{FsIh_tbPvmD_Q;LA_F;nr^sL)DP(nCWca@n8LsoUsK}VJB4dfl4T_9? zFx3gbgGvNa-+pPMR!5;Tje(adDDV=M;p`Tq}r zTUi8L`w`~ieUZBlKBu1B^QtTH`}wL{)amu&%0TU0m;Ng`NTB9kn)1rbCL6eC{7cX! mNg~0ri2_$IWmo4}Uk&?ZL-8{{relhPUVLH literal 0 HcmV?d00001 diff --git a/__pycache__/test_nearest_square.cpython-39-pytest-6.2.1.pyc b/__pycache__/test_nearest_square.cpython-39-pytest-6.2.1.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5e160c5f0b6481a059a85e1b841919bc3f9d408c GIT binary patch literal 1968 zcmd6n&2Q8=6u@oA$$XTSkJa*d*g=R@b7<8W+HJd{D^Ot%2vtZ34x^ExP-of^nIzaL z?3CmJd*rm|J#>z{QTat3q)koF`W7RU^m*H+IKo1w@3bAzEy4dJ?TWC41ASFgL>2m) zsEIoCbwM8!cWw;pksX)ng(&c4pi)o0H~?iA{nN(*r2=gmnmPg@Xiid+k+(Fbg5@lu z8GFuhE3?$QlpZkwT9*or{w^DGVW-v+ACi|u{SM=HN`_QE0?k1!VlWPR2D<6#q-R4a zoWJ=+l5^aB#(NZWJFUR1YGx1VTlxl~z)6mcLbGxv2%M|7Gqz!$V-8|OkJ;ANh#s!o zTucV5uByMDD2=TKYAdc<#J=S!x1Kk)3h%nBB!+#&wFPrfv{0;~SU+Cyl?r5P7T9zZ zIyXl(^M$V8Nd_s#(wF+Yx9f+YCxb-p#{C3BtIxo&_w1k-roBjMCyZf+(w9B8A0LFm zO!fA{_?aJik>3w=%~O6iz!mhuUGvvo9Nm{Pmih;;8_T|*dchw_=tq7EBO^!8;U9_( zHp|AXvhhpVSSyTTwT)tnh0$CY5&07Y;&^-e*Ul3-wCe1|NiXc&3)J&8PCAbU>3$q7 z^}2yr+TDlK2GL&7F#$LY)p9b>KhE%bYZk1pFxrI5>mX0zhv=Q)_YW9|Uq3qZRtd2uCBzYxZzv(vov{fw9!nyA=5EU>YV#-- zP+*wlWfXWtN>Q50`6jM2jnPfezad8d(=vMrPBA`*XaCMXU7Uqe>lVg-8mUFl-8o&I z)=YT;9Quk^RN3X?0zl Date: Sat, 9 Jan 2021 23:36:21 +0530 Subject: [PATCH 5/9] step 5 completed --- Python-ifed.ipynb | 21 +++++------------- __pycache__/nearest_square.cpython-38.pyc | Bin 0 -> 340 bytes ...nearest_square.cpython-38-pytest-6.1.1.pyc | Bin 2034 -> 2034 bytes nearest_square.py | 7 ++++++ 4 files changed, 12 insertions(+), 16 deletions(-) create mode 100644 __pycache__/nearest_square.cpython-38.pyc create mode 100644 nearest_square.py diff --git a/Python-ifed.ipynb b/Python-ifed.ipynb index 6920c9b..e76688f 100644 --- a/Python-ifed.ipynb +++ b/Python-ifed.ipynb @@ -562,7 +562,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 4, "metadata": {}, "outputs": [ { @@ -572,22 +572,11 @@ "============================= test session starts =============================\n", "platform win32 -- Python 3.8.5, pytest-6.1.1, py-1.9.0, pluggy-0.13.1\n", "rootdir: c:\\Users\\gopil\\Desktop\\Python-ifed-challenge\n", - "collected 0 items / 1 error\n", + "collected 4 items\n", + "\n", + "test_nearest_square.py .... [100%]\n", "\n", - "=================================== ERRORS ====================================\n", - "___________________ ERROR collecting test_nearest_square.py ___________________\n", - "ImportError while importing test module 'c:\\Users\\gopil\\Desktop\\Python-ifed-challenge\\test_nearest_square.py'.\n", - "Hint: make sure your test modules/packages have valid Python names.\n", - "Traceback:\n", - "..\\..\\anaconda3\\lib\\importlib\\__init__.py:127: in import_module\n", - " return _bootstrap._gcd_import(name[level:], package, level)\n", - "test_nearest_square.py:1: in \n", - " from nearest_square import nearest_square\n", - "E ModuleNotFoundError: No module named 'nearest_square'\n", - "=========================== short test summary info ===========================\n", - "ERROR test_nearest_square.py\n", - "!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!\n", - "============================== 1 error in 0.10s ===============================\n" + "============================== 4 passed in 0.01s ==============================\n" ] } ], diff --git a/__pycache__/nearest_square.cpython-38.pyc b/__pycache__/nearest_square.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f4810b6aff31b7b5948c5e7cacea9b96c541c281 GIT binary patch literal 340 zcmY*Tu}T9$5S`gO^^n9Seu3Q;@dHF+KOj`K0|a*j7GoLv5S>Vy;!ctP5jwQ)$`g!f797e!U@a t+iv64|5ieto{a%BOohux<-&3MsE%&I2H|zi`r3Hon delta 15 Wcmeyw|B0V1l$V$5#=4DcZ`c7X?**~| diff --git a/nearest_square.py b/nearest_square.py new file mode 100644 index 0000000..b1ecaa2 --- /dev/null +++ b/nearest_square.py @@ -0,0 +1,7 @@ +import math + +def nearest_square(n): + if(n<=0): + return 0 + else: + return(math.floor(n**0.5)**2) \ No newline at end of file From ba6a60bcfcf2ea30534adffbec7ecc509d13365b Mon Sep 17 00:00:00 2001 From: gopik820 Date: Sat, 9 Jan 2021 23:51:32 +0530 Subject: [PATCH 6/9] Step 6 completed --- Python-ifed.ipynb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Python-ifed.ipynb b/Python-ifed.ipynb index e76688f..31e26ea 100644 --- a/Python-ifed.ipynb +++ b/Python-ifed.ipynb @@ -562,7 +562,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 5, "metadata": {}, "outputs": [ { @@ -576,7 +576,7 @@ "\n", "test_nearest_square.py .... [100%]\n", "\n", - "============================== 4 passed in 0.01s ==============================\n" + "============================== 4 passed in 0.02s ==============================\n" ] } ], From 222ce85ea1371b5a886e7e02cfb766e4597a3a70 Mon Sep 17 00:00:00 2001 From: gopik820 Date: Sun, 10 Jan 2021 01:45:18 +0530 Subject: [PATCH 7/9] Pushing into repo --- Python-ifed.ipynb | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/Python-ifed.ipynb b/Python-ifed.ipynb index 31e26ea..9273fa1 100644 --- a/Python-ifed.ipynb +++ b/Python-ifed.ipynb @@ -635,10 +635,20 @@ "cell_type": "code", "execution_count": 1, "metadata": {}, - "outputs": [], - "source": [ - "# Insert your code here" - ] + "outputs": [ + { + "output_type": "error", + "ename": "ModuleNotFoundError", + "evalue": "No module named 'pokebase'", + "traceback": [ + "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[1;31mModuleNotFoundError\u001b[0m Traceback (most recent call last)", + "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[1;32mimport\u001b[0m \u001b[0mpokebase\u001b[0m \u001b[1;32mas\u001b[0m \u001b[0mpb\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[1;31mModuleNotFoundError\u001b[0m: No module named 'pokebase'" + ] + } + ], + "source": [] }, { "cell_type": "markdown", From da7cd6e00971d2aba14ef777705e0f79b1f0df16 Mon Sep 17 00:00:00 2001 From: gopik820 Date: Sun, 10 Jan 2021 19:15:24 +0530 Subject: [PATCH 8/9] Completed challenge 2 --- Python-ifed.ipynb | 136 ++++++++++++++---- __pycache__/ability.cpython-38.pyc | Bin 0 -> 447 bytes ...test_abilities.cpython-38-pytest-6.1.1.pyc | Bin 0 -> 1988 bytes ability.py | 9 ++ 4 files changed, 118 insertions(+), 27 deletions(-) create mode 100644 __pycache__/ability.cpython-38.pyc create mode 100644 __pycache__/test_abilities.cpython-38-pytest-6.1.1.pyc create mode 100644 ability.py diff --git a/Python-ifed.ipynb b/Python-ifed.ipynb index 9273fa1..3ddea9e 100644 --- a/Python-ifed.ipynb +++ b/Python-ifed.ipynb @@ -633,22 +633,28 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": 23, "metadata": {}, "outputs": [ { - "output_type": "error", - "ename": "ModuleNotFoundError", - "evalue": "No module named 'pokebase'", - "traceback": [ - "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[1;31mModuleNotFoundError\u001b[0m Traceback (most recent call last)", - "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[1;32mimport\u001b[0m \u001b[0mpokebase\u001b[0m \u001b[1;32mas\u001b[0m \u001b[0mpb\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m", - "\u001b[1;31mModuleNotFoundError\u001b[0m: No module named 'pokebase'" + "output_type": "stream", + "name": "stdout", + "text": [ + "Type 1: ghost\nType 2: poison\n" ] } ], - "source": [] + "source": [ + "import requests\n", + "\n", + "url = \"http://pokeapi.co/api/v2/pokemon/gengar/\"\n", + "\n", + "payload = \"\"\n", + "response = requests.request(\"GET\", url, data=payload)\n", + "data = response.json()\n", + "print(\"Type 1:\",data[\"types\"][0][\"type\"][\"name\"])\n", + "print(\"Type 2:\",data[\"types\"][1][\"type\"][\"name\"])" + ] }, { "cell_type": "markdown", @@ -661,11 +667,46 @@ }, { "cell_type": "code", - "execution_count": 2, - "metadata": {}, - "outputs": [], + "execution_count": 26, + "metadata": { + "tags": [] + }, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Damage for ghost type:\n\nghost\ndark\npoison\nbug\n\nDamage for poison type:\n\nground\npsychic\nfighting\npoison\nbug\ngrass\nfairy\n" + ] + } + ], "source": [ - "# Insert your code here" + "payload = \"\"\n", + "response = requests.request(\"GET\", url, data=payload)\n", + "\n", + "data = response.json()\n", + "url1=(data[\"types\"][0][\"type\"][\"url\"])\n", + "url2=(data[\"types\"][1][\"type\"][\"url\"])\n", + "payload1 = \"\"\n", + "payload2 = \"\"\n", + "response1 = requests.request(\"GET\", url1, data=payload1)\n", + "response2 = requests.request(\"GET\", url2, data=payload2)\n", + "data1 = response1.json()\n", + "data2 = response2.json()\n", + "print(\"Damage for ghost type:\\n\")\n", + "\n", + "for i in range(len(data1[\"damage_relations\"][\"double_damage_from\"])):\n", + " print(data1[\"damage_relations\"][\"double_damage_from\"][i][\"name\"])\n", + " \n", + "for i in range(len(data1[\"damage_relations\"][\"half_damage_from\"])):\n", + " print(data1[\"damage_relations\"][\"half_damage_from\"][i][\"name\"])\n", + "print(\"\\nDamage for poison type:\\n\")\n", + "\n", + "for i in range(len(data2[\"damage_relations\"][\"double_damage_from\"])):\n", + " print(data2[\"damage_relations\"][\"double_damage_from\"][i][\"name\"])\n", + "\n", + "for i in range(len(data2[\"damage_relations\"][\"half_damage_from\"])):\n", + " print(data2[\"damage_relations\"][\"half_damage_from\"][i][\"name\"])" ] }, { @@ -677,11 +718,59 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 34, "metadata": {}, - "outputs": [], + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "gastly,haunter,gengar,misdreavus,shedinja,\n", + "\n", + "umbreon,murkrow,sneasel,houndour,houndoom,\n", + "\n", + "sandshrew,sandslash,nidoqueen,nidoking,diglett,\n", + "\n", + "abra,kadabra,alakazam,slowpoke,slowbro,\n", + "\n" + ] + } + ], "source": [ - "# Insert your code here" + "payload = \"\"\n", + "response = requests.request(\"GET\", url, data=payload)\n", + "\n", + "data = response.json()\n", + "\n", + "url1=(data[\"types\"][0][\"type\"][\"url\"])\n", + "url2=(data[\"types\"][1][\"type\"][\"url\"])\n", + "\n", + "payload=\"\"\n", + "payload1 = \"\"\n", + "payload2 = \"\"\n", + "\n", + "response = requests.request(\"GET\", url, data=payload)\n", + "response1 = requests.request(\"GET\", url1, data=payload1)\n", + "response2 = requests.request(\"GET\", url2, data=payload2)\n", + "\n", + "pokedata = response.json()\n", + "data1 = response1.json()\n", + "data2 = response2.json()\n", + "damage=[]\n", + "\n", + "\n", + "for i in range(len(data1[\"damage_relations\"][\"double_damage_from\"])):\n", + " damage.append(data1[\"damage_relations\"][\"double_damage_from\"][i][\"url\"])\n", + "\n", + "\n", + "for i in range(len(data2[\"damage_relations\"][\"double_damage_from\"])):\n", + " damage.append(data2[\"damage_relations\"][\"double_damage_from\"][i][\"url\"])\n", + "\n", + "for i in range(len(damage)):\n", + " pokedata = requests.request(\"GET\", damage[i], data=payload).json()\n", + " for j in range(5):\n", + " print(pokedata[\"pokemon\"][j][\"pokemon\"][\"name\"],end=',')\n", + " print(\"\\n\")" ] }, { @@ -695,21 +784,14 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": 12, "metadata": {}, "outputs": [ { - "name": "stdout", "output_type": "stream", + "name": "stdout", "text": [ - "\u001b[1m============================= test session starts ==============================\u001b[0m\n", - "platform darwin -- Python 3.8.5, pytest-6.2.1, py-1.10.0, pluggy-0.13.1\n", - "rootdir: /Users/abhijitramesh/development/Python-ifed\n", - "collected 4 items \u001b[0m\n", - "\n", - "test_abilities.py \u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m [100%]\u001b[0m\n", - "\n", - "\u001b[32m============================== \u001b[32m\u001b[1m4 passed\u001b[0m\u001b[32m in 2.75s\u001b[0m\u001b[32m ===============================\u001b[0m\n" + "============================= test session starts =============================\nplatform win32 -- Python 3.8.5, pytest-6.1.1, py-1.9.0, pluggy-0.13.1\nrootdir: c:\\Users\\gopil\\Desktop\\Python-ifed-challenge\ncollected 4 items\n\ntest_abilities.py .... [100%]\n\n============================== 4 passed in 1.51s ==============================\n" ] } ], diff --git a/__pycache__/ability.cpython-38.pyc b/__pycache__/ability.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d8069240535ecbbfba83b2c16beef9dba5c24820 GIT binary patch literal 447 zcmYjNO-sW-5S>Z3HA?HLSbFp#QGa!W2d1ROZV-~udTuLmP|I;&V|uFR5g)&t(? z!5R@37o|yin&Xf2sZ!a{ak6wK{45#-sYB$vUv4Y&G;ucQxX1oW6h|r&QXlQYLbJr5 z3!7;x7mKBkN@_C{O0zeaCc5conMk33)}Qlv{X2Vo$9JomdCf z)SlS-4@2Kr+@071%02WCteL}G#(v|>$bqLHLEJTDM%8oBJk)Xv;-F7JuV=cLtr_M1 zpUx(kI(X@clTy%KgRA|CJEO1YZvcWrrZ^}JxC_fRz^-TG8T z#iO=1g7E>ThDvE0;ZX9het%Wl62Dd_8f%De9UB6KUcgv9x+Qdv%r{X@7GFGBg{UR%w5>*Gn z@!l|%Ce3x_$pTjB>O!pdi=pK8(m0XD9+Pp-GEuc-%?1K@s5XACPfd&bfl`I4&cuU4 zWz59lWhq(C3`FK$w1y`%7re4;{IG0XUp9VhjApl+QGLb6xUw@R>I?vJbfyrS6L!Ofk*&ym1c)v{4w-7x^)Wlk$>1&{n#hsd_?lDchW12pMctg{tNXZ3FJ=8x- z)7FBfK5zdIng&4AGCcsI4kJ$+NK${iF4JV+ffNWZOa>I(5fh_SDRd6ylsQPg3am1gnH04oRXre)n`z82zBD-h#(omF&K zTEGQ}g=>}nsa+~uTwRQt2D{z#IB0s?N*t=xK(jn{Rjq|j1@KN&SlCe%7J Date: Sun, 10 Jan 2021 20:18:29 +0530 Subject: [PATCH 9/9] Final push --- __pycache__/ability.cpython-39.pyc | Bin 0 -> 447 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 __pycache__/ability.cpython-39.pyc diff --git a/__pycache__/ability.cpython-39.pyc b/__pycache__/ability.cpython-39.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a03ea6f32aca0d4be1c7af88f1716af5904769e3 GIT binary patch literal 447 zcmYjNO-sW-5S>Z38m0AAEIoP=a%clygd!r^a}mT#h)B$?X>6LL*{u*sZvK$==wI5a zC;vkA;3Vy#1M}X@Jm!P(JDp=7Tl{XG|A@cqWZw)*ZpdYqfCI-ET;K*bKfy(g4`8z& zQeYBbO*?B5*M3JXZwWY-(4)Q{RH$HuC9ZL0tf4YOsLYb)^*`oLR# zSR=yXyfkUg!Q|s?s#G>|oGhIQKZ}Mz>JT~a7fofJCe8*O_sD;V;z&h8>ceeVXqNbM zVKZ&zVzCrbNo|HgY4#@5L?8HBCK7J9az>|WbD77QabNkawe61!jnNn6ZIU;a!N_}* zB9~s6W>M^og`BB0^X>~ZO_M?ND)=Cn`f)6hP