diff --git a/Introduction-to-Data-Science/Pandas_assignment/Prateek/Assignment_pandas.py b/Introduction-to-Data-Science/Pandas_assignment/Prateek/Assignment_pandas.py new file mode 100644 index 0000000..bb05d0d --- /dev/null +++ b/Introduction-to-Data-Science/Pandas_assignment/Prateek/Assignment_pandas.py @@ -0,0 +1,102 @@ + +# coding: utf-8 + +# In[1]: + + +import pandas as pd +import numpy as np + + +# In[2]: + + +player_match=pd.read_csv("/home/prateek/Documents/Python/Data_science/Data_science_smp/Ipl/DIM_PLAYER_MATCH.csv",encoding="ISO-8859-1",skiprows=[1]) + + +# In[3]: + + +player_match + + +# In[4]: + + +#Q1: +for i in range(2008,2018): + yp=player_match.loc[(player_match.Age_As_on_match<25) & (player_match.Season_year==i)] + lyp=len(yp) + l=len(player_match) + per=(lyp/l)*100 + team=yp.Player_team.value_counts().index[0] + print("% of young players and team having max players in {:d} season={:f} and {}".format(i,per,team)) +yp=player_match.loc[(player_match.Age_As_on_match<25) & (player_match.is_manofThematch==1.0)] +lyp=len(yp) +l=len(player_match) +per=(lyp/l)*100 +print("Percentage of man of the match award won by young player={}".format(per)) + + +# In[11]: + + +#Q2: +def bowl(s): + if(s=="Legbreak" or s=="Legbreak googly"): + s="right-handed leg spin bowler" + return s +player_match.Bowling_skill=player_match.Bowling_skill.map(bowl,na_action="ignore") + +def null(srs): + if(pd.isnull(srs.Bowling_skill)==True): + srs.Bowling_skill=srs.Batting_hand + return srs +player_match=player_match.apply(null,axis="columns") +right=len(player_match.loc[player_match.Bowling_skill.str.contains("right",case=False) & player_match.is_manofThematch==1]) +left=len(player_match.loc[player_match.Bowling_skill.str.contains("left",case=False) & player_match.is_manofThematch==1]) +print("Number of times man of the match recieved by right handed player={} , and left handed player={}".format(right,left)) + + +# In[8]: + + +#Q3: +right_list=list((player_match.loc[player_match.Batting_hand.str.contains("right",case=False) & player_match.is_manofThematch==1]).Player_Name.value_counts().index[0:2]) + +left_list=list((player_match.loc[player_match.Batting_hand.str.contains("left",case=False) & player_match.is_manofThematch==1]).Player_Name.value_counts().index[0:2]) + +keeper=((player_match.loc[((player_match.Role_Desc=="Keeper") | (player_match.Role_Desc=="CaptainKeeper")) & player_match.is_manofThematch==1]).Player_Name.value_counts().index[0]) + + +pacers=list(player_match.loc[((player_match.Bowling_skill.str.contains("fast")) | (player_match.Bowling_skill.str.contains("medium"))) & player_match.is_manofThematch==1].Player_Name.value_counts().index[10:13]) + +A_rounder=(player_match.loc[((player_match.Bowling_skill.str.contains("fast")) | (player_match.Bowling_skill.str.contains("medium"))) & player_match.is_manofThematch==1].Player_Name.value_counts().index[8]) + +spin=list(player_match.loc[((player_match.Bowling_skill.str.contains("break")) | (player_match.Bowling_skill.str.contains("slow")) | (player_match.Bowling_skill.str.contains("spin")) ) & player_match.is_manofThematch==1].Player_Name.value_counts().index[[7,12]]) +#player_match.Bowling_skill.unique() + +type(right_list) +team=right_list+left_list+pacers+spin +#right_list.append(keeper) +team.append(keeper) +team.append(A_rounder) +print("best team is:",team) + + +# In[10]: + + +#Q4: +match=pd.read_excel("/home/prateek/Documents/Python/Data_science/Data_science_smp/Ipl/DIM_MATCH.xlsx",encoding="ISO-8859-1") +match.dropna(axis="index",subset=["match_winner"],inplace=True) +match + +def win_lose(d): + if(d.match_winner!=d.Team1): + d.match_winner=d.match_winner+"-"+d.Team1 + else: + d.match_winner=d.match_winner+"-"+d.Team2 + return d +(match.apply(win_lose,axis="columns")).match_winner.value_counts().index[0] + diff --git a/Introduction-to-Data-Science/README.md b/Introduction-to-Data-Science/README.md deleted file mode 100644 index e5dd563..0000000 --- a/Introduction-to-Data-Science/README.md +++ /dev/null @@ -1,33 +0,0 @@ -## Instructions to submit assignments - -**1) Fork the repository.** - -**2) Clone the forked repo:** - - git clone https://github.com/your-username/SMP18.git - -**3) Change directory and create a folder with your name.** -Inside the folder create a text file with your details. - - cd SMP18 - cd Week- // where X corresponds to the week number - mkdir your-name - cd your-name - -**4) Add and commit changes. Push it to your repository.** - - git add . // adds all files - git commit -m "Your message" - git push origin master - -**5) Login to github and send a pull request to *ISTE-NITK/SMP18**** -To configure upstream: - - git remote add upstream https://github.com/ISTE-NITK/SMP18.git - -To pull the latest changes: - - git fetch upstream - git checkout master - git merge upstream/master - diff --git a/Introduction-to-Data-Science/Rakesh/Assignment1/assignment1.sh b/Introduction-to-Data-Science/Rakesh/Assignment1/assignment1.sh deleted file mode 100644 index dd708e0..0000000 --- a/Introduction-to-Data-Science/Rakesh/Assignment1/assignment1.sh +++ /dev/null @@ -1,12 +0,0 @@ -l=$( < "file.txt" wc -l) -s=$(head -3 file.txt|grep the| wc -l) -q=$(expr "$l" - "3") -d=$(tail -$q file.txt| grep for| wc -l) - -ans=$(expr "$s" \* "$s" + "$d") - -sed -i -e '1,3s/the/it/g' file.txt -sed -i -e '4,$s/for/when/g' file.txt -sort -r file.txt - -echo "$ans" diff --git a/Introduction-to-Data-Science/Week-1/AdityaGourishetty/Assignment1.sh b/Introduction-to-Data-Science/Week-1/AdityaGourishetty/Assignment1.sh deleted file mode 100644 index 5486a6a..0000000 --- a/Introduction-to-Data-Science/Week-1/AdityaGourishetty/Assignment1.sh +++ /dev/null @@ -1,6 +0,0 @@ -read fname -STAR=$(head -3 $fname|grep the|wc -l) -DIAMOND=$(tail -n+4 $fname|grep -e for|wc -l) -cost=`expr \( $STAR \* $STAR \) + $DIAMOND` -sed -e '4,$s/for/when/g' -e '1,3s/the/it/g' $fname|sort -r -echo "cost = $cost" diff --git a/Introduction-to-Data-Science/Week-1/AdityaJain/assgn1.sh b/Introduction-to-Data-Science/Week-1/AdityaJain/assgn1.sh deleted file mode 100755 index 4bbee07..0000000 --- a/Introduction-to-Data-Science/Week-1/AdityaJain/assgn1.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash - -#counting the number of star lines and diamond lines -STLINES=$(head -3 $1|grep -wc "the") -DILINES=$(tail -n +4 $1|grep -wc "for") - -#calculating cost -COST=$(($STLINES*$STLINES+$DILINES)) - -#editing the file -sed -i -e '1,3{s/\/it/g}' -e '4,${s/\/when/g}' $1 - -#printing in reverse sorted order and printing the cost -sort -r $1 -echo $COST diff --git a/Introduction-to-Data-Science/Week-1/Amodh/assignment 1.sh b/Introduction-to-Data-Science/Week-1/Amodh/assignment 1.sh deleted file mode 100755 index 55ba61e..0000000 --- a/Introduction-to-Data-Science/Week-1/Amodh/assignment 1.sh +++ /dev/null @@ -1,7 +0,0 @@ -n=$(wc -l <$1) -n=`expr $n - 3` -star=$(head -3 $1|grep the|wc -l) -diamond=$(tail -$n $1| grep -F 'for'| wc -l) -cost=$(($star*$star +$diamond)) -{ head -3 $1|sed 's/the/it/'; tail -$n $1|sed 's/for/when/' ;} | sort -r -echo cost=$cost diff --git a/Introduction-to-Data-Science/Week-1/AmoghSabane/assignment1.sh b/Introduction-to-Data-Science/Week-1/AmoghSabane/assignment1.sh deleted file mode 100644 index 55ba61e..0000000 --- a/Introduction-to-Data-Science/Week-1/AmoghSabane/assignment1.sh +++ /dev/null @@ -1,7 +0,0 @@ -n=$(wc -l <$1) -n=`expr $n - 3` -star=$(head -3 $1|grep the|wc -l) -diamond=$(tail -$n $1| grep -F 'for'| wc -l) -cost=$(($star*$star +$diamond)) -{ head -3 $1|sed 's/the/it/'; tail -$n $1|sed 's/for/when/' ;} | sort -r -echo cost=$cost diff --git a/Introduction-to-Data-Science/Week-1/Dhruv/assignment1.sh b/Introduction-to-Data-Science/Week-1/Dhruv/assignment1.sh deleted file mode 100755 index 4cb7049..0000000 --- a/Introduction-to-Data-Science/Week-1/Dhruv/assignment1.sh +++ /dev/null @@ -1,9 +0,0 @@ -head -3 $1 | sed 's/the/it/' > output.txt -tail -4 $1 | sed 's/for/when/' >> output.txt -star=$(head -3 $1 | grep "the" | wc -l | bc) -diamond=$(tail -4 $1 | grep "for" | wc -l | bc) -cost=`echo "$star * $star + $diamond"|bc` -sort -r output.txt -echo "cost = $cost" - - diff --git a/Introduction-to-Data-Science/Week-1/KRahulReddy/Assignment 1.sh b/Introduction-to-Data-Science/Week-1/KRahulReddy/Assignment 1.sh deleted file mode 100755 index 3502259..0000000 --- a/Introduction-to-Data-Science/Week-1/KRahulReddy/Assignment 1.sh +++ /dev/null @@ -1,22 +0,0 @@ -#Calculating lines in file -len=$(cat file.txt|wc -l) - -#Value of star -star=$(head -3 file.txt|grep the|wc -l) - -#Value of diamond -tail_len=`expr $len - 3` -diamond=$(tail -$tail_len file.txt|grep for|wc -l) - -a=$(head -3 file.txt|sed 's/the/it/g'|sort -r) - -b=$(tail -$tail_len file.txt|sed 's/for/when/g'|sort -r) - -#make empty file temp.txt to store edited content ->temp.txt - -echo -e "$a\n$b" >> temp.txt - -echo "$(cat temp.txt|sort -r)" -cost=$(expr $star \* $star + $diamond) -echo "Cost = $cost" diff --git a/Introduction-to-Data-Science/Week-1/KRahulReddy/details.txt b/Introduction-to-Data-Science/Week-1/KRahulReddy/details.txt deleted file mode 100644 index 26c942d..0000000 --- a/Introduction-to-Data-Science/Week-1/KRahulReddy/details.txt +++ /dev/null @@ -1,3 +0,0 @@ -Name : K Rahul Reddy -Roll : 17CO119 - diff --git a/Introduction-to-Data-Science/Week-1/KRahulReddy/file.txt b/Introduction-to-Data-Science/Week-1/KRahulReddy/file.txt deleted file mode 100644 index c25f5da..0000000 --- a/Introduction-to-Data-Science/Week-1/KRahulReddy/file.txt +++ /dev/null @@ -1,7 +0,0 @@ -Hello, and good morning to you -the sun is beautifully shining outside -where are the chirping birds -why the mountains look tall -for when the rains come -it will flood the region -and we will be forgiven diff --git a/Introduction-to-Data-Science/Week-1/KRahulReddy/temp.txt b/Introduction-to-Data-Science/Week-1/KRahulReddy/temp.txt deleted file mode 100644 index 2574ce3..0000000 --- a/Introduction-to-Data-Science/Week-1/KRahulReddy/temp.txt +++ /dev/null @@ -1,7 +0,0 @@ -where are it chirping birds -it sun is beautifully shining outside -Hello, and good morning to you -why the mountains look tall -when when the rains come -it will flood the region -and we will be whengiven diff --git a/Introduction-to-Data-Science/Week-1/Madhumitha/Details.txt b/Introduction-to-Data-Science/Week-1/Madhumitha/Details.txt deleted file mode 100644 index 11f5399..0000000 --- a/Introduction-to-Data-Science/Week-1/Madhumitha/Details.txt +++ /dev/null @@ -1,4 +0,0 @@ -Madhumitha Nara -Information Technology -171IT125 -Phone: 7981819450 \ No newline at end of file diff --git a/Introduction-to-Data-Science/Week-1/Madhumitha/assignment1.sh b/Introduction-to-Data-Science/Week-1/Madhumitha/assignment1.sh deleted file mode 100644 index 387ebc0..0000000 --- a/Introduction-to-Data-Science/Week-1/Madhumitha/assignment1.sh +++ /dev/null @@ -1,25 +0,0 @@ -echo "Input: - -" -cat $1 - -echo " - -Output: - -" - -head -3 $1|sed 's/the/it/' > temp -tail -n +4 $1|sed 's/for/when/'>> temp -sort -r temp|cat - -head -3 $1|grep "the"|wc > xxx -read slines swords scharacters sfilename < xxx - -tail -n +4 $1|grep "for"|wc > yyy -read dlines dwords dcharacters dfilename < yyy - -cost=$(echo "scale=2;$slines*$slines+$dlines"|bc) -echo " - -Cost=$cost" diff --git a/Introduction-to-Data-Science/Week-1/Madhuparna/Assignment1.sh b/Introduction-to-Data-Science/Week-1/Madhuparna/Assignment1.sh deleted file mode 100644 index c312527..0000000 --- a/Introduction-to-Data-Science/Week-1/Madhuparna/Assignment1.sh +++ /dev/null @@ -1,10 +0,0 @@ -lines=$( < "file.txt" wc -l) -STAR=$(head -3 file.txt|grep "the"| wc -l) -q=$(expr "$lines" - "3") -DIAMOND=$(tail -$q file.txt| grep "for"| wc -l) -COST=$(expr "$STAR" \* "$STAR") -COST=$(expr "$COST" + "$DIAMOND") -sed -i -e '1,3s/the/it/g' file.txt -sed -i -e '4,$s/for/when/g' file.txt -sort -r file.txt -echo "$COST" diff --git a/Introduction-to-Data-Science/Week-1/Niranjan/prog.sh b/Introduction-to-Data-Science/Week-1/Niranjan/prog.sh deleted file mode 100755 index bb2f9c6..0000000 --- a/Introduction-to-Data-Science/Week-1/Niranjan/prog.sh +++ /dev/null @@ -1,10 +0,0 @@ -star=$(head -3 $1|grep "the"| wc -l) -n=$(grep -c ^ $1) -a=$(expr "$n" - "3") -diam=$(tail -$a $1| grep "for"| wc -l) -c=$(expr "$star" \* "$star") -c=$(expr "$c" + "$diam") -sed -i -e '1,3s/the/it/g' $1 -sed -i -e '4,$s/for/when/g' $1 -sort -r $1 -echo "$c" diff --git a/Introduction-to-Data-Science/Week-1/Ramanan/Assignment1.sh b/Introduction-to-Data-Science/Week-1/Ramanan/Assignment1.sh deleted file mode 100644 index 55ba61e..0000000 --- a/Introduction-to-Data-Science/Week-1/Ramanan/Assignment1.sh +++ /dev/null @@ -1,7 +0,0 @@ -n=$(wc -l <$1) -n=`expr $n - 3` -star=$(head -3 $1|grep the|wc -l) -diamond=$(tail -$n $1| grep -F 'for'| wc -l) -cost=$(($star*$star +$diamond)) -{ head -3 $1|sed 's/the/it/'; tail -$n $1|sed 's/for/when/' ;} | sort -r -echo cost=$cost diff --git a/Introduction-to-Data-Science/Week-1/Ramanan/Details.txt b/Introduction-to-Data-Science/Week-1/Ramanan/Details.txt deleted file mode 100644 index c1d7e06..0000000 --- a/Introduction-to-Data-Science/Week-1/Ramanan/Details.txt +++ /dev/null @@ -1,3 +0,0 @@ -Ramanan R -Civil Engineering -171CV233 diff --git a/Introduction-to-Data-Science/Week-1/Ramanan/Test.md b/Introduction-to-Data-Science/Week-1/Ramanan/Test.md deleted file mode 100644 index b0e6d21..0000000 --- a/Introduction-to-Data-Science/Week-1/Ramanan/Test.md +++ /dev/null @@ -1 +0,0 @@ -##Testing Testing diff --git a/Introduction-to-Data-Science/Week-1/Ramanan/datasciencecoursera b/Introduction-to-Data-Science/Week-1/Ramanan/datasciencecoursera deleted file mode 160000 index 8244a4f..0000000 --- a/Introduction-to-Data-Science/Week-1/Ramanan/datasciencecoursera +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 8244a4fd95de3b051d975208969660d068eca7e9 diff --git a/Introduction-to-Data-Science/Week-1/RohitMP/prog1.sh b/Introduction-to-Data-Science/Week-1/RohitMP/prog1.sh deleted file mode 100755 index 7a2a879..0000000 --- a/Introduction-to-Data-Science/Week-1/RohitMP/prog1.sh +++ /dev/null @@ -1,12 +0,0 @@ - -i=$(head -3 $1 | grep the -c) -j=$(tail --lines=+4 $1 | grep for -c) -s=$(echo "$i*$i+$j" | bc) -head -3 $1 | sed 's/the/it/g' > temp1.txt -tail --lines=+4 $1 | sed 's/for/when/g' > temp2.txt -cat temp1.txt temp2.txt | sort -r > $1 -cat $1 -echo "cost = $s" -rm temp1.txt temp2.txt - - diff --git a/Introduction-to-Data-Science/Week-1/S.R.Sahith/assg1.sh b/Introduction-to-Data-Science/Week-1/S.R.Sahith/assg1.sh deleted file mode 100755 index 3d57012..0000000 --- a/Introduction-to-Data-Science/Week-1/S.R.Sahith/assg1.sh +++ /dev/null @@ -1,5 +0,0 @@ -a=$(sed -n '1,3 s/the/it/pg' $1|wc -l) -b=$(sed -n '4,$ s/for/when/pg' $1|wc -l) -sed '1,3 s/the/it/g' $1 |sed '3,$ s/for/when/g'|sort -r -c=`expr $a \* $a + $b` -echo "cost=$c" diff --git a/Introduction-to-Data-Science/Week-1/SAURABH/ASSIGNMENT1.sh b/Introduction-to-Data-Science/Week-1/SAURABH/ASSIGNMENT1.sh deleted file mode 100755 index 0c447d5..0000000 --- a/Introduction-to-Data-Science/Week-1/SAURABH/ASSIGNMENT1.sh +++ /dev/null @@ -1,7 +0,0 @@ -n=$(wc -l < $1) -sed -e '1,3 s/the/it/g' -e "4,$n s/for/when/g" $1|sort -r -j=$(head -3 $1|grep "the"|wc -l) -k=$(tail -4 $1|grep "for"|wc -l) -res=$((($j*$j)+$k)) -echo "cost=$res" - diff --git a/Introduction-to-Data-Science/Week-1/SakshatRao/assignment1.sh b/Introduction-to-Data-Science/Week-1/SakshatRao/assignment1.sh deleted file mode 100755 index 4318ecd..0000000 --- a/Introduction-to-Data-Science/Week-1/SakshatRao/assignment1.sh +++ /dev/null @@ -1,5 +0,0 @@ -star=$(head -3 $1|grep -c 'the') -diamond=$(tail +4 $1|grep -c 'for') -cost=$(echo "scale=1; $star*$star+$diamond"|bc) -(head -3 $1|sed 's/the/it/'; tail +4 $1|sed 's/for/when/')|sort -r -echo "cost = $cost" diff --git a/Introduction-to-Data-Science/Week-1/Shashank/first.sh b/Introduction-to-Data-Science/Week-1/Shashank/first.sh deleted file mode 100755 index bb8c0f4..0000000 --- a/Introduction-to-Data-Science/Week-1/Shashank/first.sh +++ /dev/null @@ -1,11 +0,0 @@ -STAR=$(head -3 $1|grep -i the|wc -l) -li=($(wc -l $1)) -((li=$li - 3)) -DIAMOND=$(tail -$li $1|grep -i for|wc -l) -cost=`expr $STAR \* $STAR + $DIAMOND` -head -3 $1|sed 's/the/it/g' >temp1.txt -tail -$li $1|sed 's/for/when/g' >temp2.txt -cat temp1.txt temp2.txt|sort -r -echo "cost = "$cost - - diff --git a/Introduction-to-Data-Science/Week-1/Siddhartha/Assignment1.sh b/Introduction-to-Data-Science/Week-1/Siddhartha/Assignment1.sh deleted file mode 100644 index 236158c..0000000 --- a/Introduction-to-Data-Science/Week-1/Siddhartha/Assignment1.sh +++ /dev/null @@ -1,5 +0,0 @@ -star=$(head -3 $1|grep -c "the") -dia=$(tail -n +3 $1|grep -c "for") -cat $1|sed '1,3 s/the/it/g'|sed '3,$ s/for/when/g'|sort -r -cost=$(echo "$star * $star + $dia"|bc) -echo "cost = $cost" diff --git a/Introduction-to-Data-Science/Week-1/aditya-rastogi/assignment-1.sh b/Introduction-to-Data-Science/Week-1/aditya-rastogi/assignment-1.sh deleted file mode 100644 index 5c48246..0000000 --- a/Introduction-to-Data-Science/Week-1/aditya-rastogi/assignment-1.sh +++ /dev/null @@ -1,5 +0,0 @@ -s=$(head -3 $1|grep -c "the") -d=$(tail -n +3 $1|grep -c "for") -c=`expr $s \* $s + $d` -cat $1|sed '1,3 s/the/it/g'|sed '3,$ s/for/when/g'|sort -r -echo "cost = $c" diff --git a/Introduction-to-Data-Science/Week-1/chandana/assignment1.sh b/Introduction-to-Data-Science/Week-1/chandana/assignment1.sh deleted file mode 100644 index 321d209..0000000 --- a/Introduction-to-Data-Science/Week-1/chandana/assignment1.sh +++ /dev/null @@ -1,10 +0,0 @@ -lines=$( < "fil.txt" wc -l) -star=$(head -3 file.txt| grep "the"| wc -l) -n=$(expr "$lines" - "3") -diamond=$(tail -$n fil.txt| grep "for"| wc -l) -sed -i -e '1,3s/the/it/g' fil.txt -sed -i -e '4,$s/for/when/g' fil.txt -sort -r fil.txt -x=$(expr "$star" \* "$star") -cost=$(expr "$x" + "$diamond") -echo "$cost" diff --git a/Introduction-to-Data-Science/Week-2/AdityaJain/assgn1.txt b/Introduction-to-Data-Science/Week-2/AdityaJain/assgn1.txt deleted file mode 100644 index bfe4791..0000000 --- a/Introduction-to-Data-Science/Week-2/AdityaJain/assgn1.txt +++ /dev/null @@ -1,68 +0,0 @@ -Q1. Pros - 1. Python is easy to read and easy to learn - 2. It is an Object Oriented Programming language. At the same time it supports Procedural and Functional programming paradigams. - 3. It provides a large collection of standard libraries -Cons - 1. It is slow as it is an interpreted language. - 2. It is not suitable for memory intensive tasks as it has a high memory usage due to its flexibilty. - -Q2. The parentheses () operator has the highest precendence. - -Q3. //-Floor divison operator. It performs divison on the two operands and returns the greatest integer smaller than the - answer of the divison. If any one of the operands is of float type then the returned number is also of float type with - zero as the fractional part. - Eg : 11//6 = 1 - 34.0//5 = 6.0 - -9.0//2 = -5.0 - -Q4. Program to delete alternate elements in a given list - -#!/usr/bin/python3 - -list=[] -n=int(input('No. of elements : ')) - -#Taking user input -print('Input :') -for i in range(0,n) : - list.append(input()) -print('Input list :\n',list) - -del list[1::2] #delete elements using extended slicing. Slice starting from index 1 to the end of the list in steps of 2 - -#printing the new list -print('Edited list :\n',list) - -Q5. Program to sort a given a list - -#!/usr/bin/python3 - -n,temp,list=int(input('Enter no. of elements : ')),0,[] - -#taking user input -print('Input %d integers :'%n) -for i in range(0,n) : - list.append(int(input())) -print('Input : ',list) - -#sorting the list using Insertion Sort -for i in range(1,n) : - j=i-1 - while (list[j+1] < list[j] and j>=0) : - temp=list[j] - list[j]=list[j+1] - list[j+1]=temp - j-=1 - -#printing sorted list -print('Sorted list : ',list) - -Q6. Program to print the given star pattern. - -#!/usr/bin/python3 - -n=int(input('Input n : ')) #taking user input - -#printing the pattern -for i in range(1,n+1) : - print(' '*(n-i),end=("*"*(2*i-1)+"\n")) -for i in range (n-1,0,-1) : - print(' '*(n-i),end=('*'*(2*i-1)+'\n')) diff --git a/Introduction-to-Data-Science/Week-2/Amodh/assignment2 b/Introduction-to-Data-Science/Week-2/Amodh/assignment2 deleted file mode 100644 index 6b6f317..0000000 --- a/Introduction-to-Data-Science/Week-2/Amodh/assignment2 +++ /dev/null @@ -1,55 +0,0 @@ -1. Pros: -a)Python is a high level language -b)It has great readability. -c) It is extremely effective as "glue' code, to join parts coded in different languages. -d)It is very easy to learn and code can be developed much faster. - -Cons: -a) It is very slow to execute. - - -2. Exponentiation operator (**) - - -3. // is called the floor division operator. It basically rounds off the answer we get after dividing to greatest integer lesser than or equal to the answer. -So 10//4=2, not 2.5 - - -4. -print("Enter the list members") -l = input(">>>").split() -ans = [] -for i in l: - if (i not in ans): - ans.append(i) -print("The list without alternate entries is:", end="") -print(ans) - - -5. -print("Enter the list members") -l = input(">>>").split() -for i in range(len(l)-1): - for j in range(len(l)-1-i): - if l[j] > l[j+1]: - l[j], l[j+1] = l[j+1], l[j] -print("The sorted list is:", end="") -print(l) - - -6. -print("Enter n") -n = int(input(">>>")) -for i in range(1,n+1): - for j in range(n-i): - print(end=" ") - for j in range(2*i-1): - print("*",end="") - print() -for i in range(1,n): - for j in range(i): - print(end=" ") - for j in range(2*(n-i)-1): - print("*",end="") - print() - diff --git a/Introduction-to-Data-Science/Week-2/AmoghSabane/Assignment2 b/Introduction-to-Data-Science/Week-2/AmoghSabane/Assignment2 deleted file mode 100644 index 17df5b2..0000000 --- a/Introduction-to-Data-Science/Week-2/AmoghSabane/Assignment2 +++ /dev/null @@ -1,55 +0,0 @@ -A1) -Pros: 1. Code readability - 2. High level - 3. Capable of being used to develp glue code - 4. Less time to develop code - -Cons: 1. Slower to execute - -A2) -Exponentiation operator (**) - -A3) -The 'Floor division' operator outputs only the whole number part of the division operation. For example, 10/4=2.5 whereas 10//4=2. - -A4) -n = input('Input list length ') -list = [] * 100 -for i in range(0,n): - j = input('Input value ') - list.insert(i,j) -for i in range(1,(n/2)+1): - del list[i] -print("The list after deletion of alternate entries is: ") -print list - -A5) -n = input('Input list length ') -list = [] * 100 -for i in range(0,n): - j = input('Input element ') - list.insert(i,j) -for i in range(0,n-1): - for j in range(i+1,n): - if list[i]>list[j]: - temp = list[i] - list[i] = list[j] - list[j] = temp -print("The sorted list is:") -print list - -A6) -n = input('Input n ') -for i in range(1,n+1): - for j in range(0,(2*n)-1-i): - print " ", - for k in range(0,(2*i)-1): - print "*", - print "\n" -for i in range(n-1,0,-1): - for j in range(0,(2*n)-1-i): - print " ", - for k in range(0,(2*i)-1): - print "*", - print "\n" - diff --git a/Introduction-to-Data-Science/Week-2/Animesh_Kumar/assignment_1_2_3.txt b/Introduction-to-Data-Science/Week-2/Animesh_Kumar/assignment_1_2_3.txt deleted file mode 100644 index a363110..0000000 --- a/Introduction-to-Data-Science/Week-2/Animesh_Kumar/assignment_1_2_3.txt +++ /dev/null @@ -1,44 +0,0 @@ -QUESTION 1: - Advantages of Python - -#1-Python is easy to learn for even a novice developer. Its code is easy to read and you can do a lot of things just by looking at it. Also, you can execute a lot of complex functionalities with ease, thanks to the standard library. - -#2- Supports multiple systems and platforms. - -#3- Object Oriented Programming-driven. - -#4- With the introduction of Raspberry Pi, a card sized microcomputer, Python has expanded its reach to unprecedented heights. Developers can now build cameras, radios and games with ease. So, learning Python could open new avenues for you to create some out-of-the box gadgets. - -#5- Python has a plethora of frameworks that make web programming very flexible. Django is the most famous Python framework for web development. - -#6- Gives rise to quick development by using less code. Even a small team can handle Python effectively. - -#7- Allows to scale even the most complex applications with ease. - -#8- A large number of resources are available for Python. - -#9- Offers a built in testing framework to set debugging time and enable fastest workflows. - -#10- IT giants like Yahoo, Google, IBM, NASA, Nokia and Disney prefer Python. - -Disadvantages of Python - -#1- Python is slow. - -#2- Python is not a very good language for mobile development. - -#3- Python is not a good choice for memory intensive tasks. - -#4- It's near impossible to build a high-graphic 3D game using Python. - -#5- Has limitations with database access. - -#6- Python is not good for multi-processor/multi-core work. - -QUESTION 2: -The Exponent operator("**") has the highest priority in an expression - -Question 3: -The // operator is the Floor division operator which does an integer division and gets an integer result, discarding any fractional result. -eg: 7//2 = 3 - diff --git a/Introduction-to-Data-Science/Week-2/Animesh_Kumar/del_alternate.py b/Introduction-to-Data-Science/Week-2/Animesh_Kumar/del_alternate.py deleted file mode 100644 index c0919db..0000000 --- a/Introduction-to-Data-Science/Week-2/Animesh_Kumar/del_alternate.py +++ /dev/null @@ -1,5 +0,0 @@ -s= input("""Enter list elements separated by comma(",")\n""" ) -list_a=list(map(int,s.split(","))) -for i in list_a: - list_a.remove(i) -print(list_a) diff --git a/Introduction-to-Data-Science/Week-2/Animesh_Kumar/empty_file.txt b/Introduction-to-Data-Science/Week-2/Animesh_Kumar/empty_file.txt deleted file mode 100644 index 8b13789..0000000 --- a/Introduction-to-Data-Science/Week-2/Animesh_Kumar/empty_file.txt +++ /dev/null @@ -1 +0,0 @@ - diff --git a/Introduction-to-Data-Science/Week-2/Animesh_Kumar/pattern.py b/Introduction-to-Data-Science/Week-2/Animesh_Kumar/pattern.py deleted file mode 100644 index 18d3b5b..0000000 --- a/Introduction-to-Data-Science/Week-2/Animesh_Kumar/pattern.py +++ /dev/null @@ -1,16 +0,0 @@ -n=int(input("Enter The value of N\n")) -print (n) -for i in range(0,n): - for k in range(n-i-1,0,-1): - print(" ",end="") - for j in range(0,2*i+1): - print("*",end="") - print("\n") -for i in range(n-2,-1,-1): - for k in range(n-1-i,0,-1): - print(" ",end="") - - for j in range(0,2*i+1): - print("*",end="") - print("\n") - diff --git a/Introduction-to-Data-Science/Week-2/Animesh_Kumar/sort.py b/Introduction-to-Data-Science/Week-2/Animesh_Kumar/sort.py deleted file mode 100644 index 0fa8e0c..0000000 --- a/Introduction-to-Data-Science/Week-2/Animesh_Kumar/sort.py +++ /dev/null @@ -1,9 +0,0 @@ -s= input("""Enter list elements separated by comma(",")\n""" ) -a_list=list(map(int,s.split(","))) -n=len(a_list) -for i in range(0,n): - for j in range(0,n-i-1): - if(a_list[j]>a_list[j+1]): - a_list[j],a_list[j+1]=a_list[j+1],a_list[j] - -print(a_list) diff --git a/Introduction-to-Data-Science/Week-2/K Rahul Reddy/Assignment 2.txt b/Introduction-to-Data-Science/Week-2/K Rahul Reddy/Assignment 2.txt deleted file mode 100644 index d3a168c..0000000 --- a/Introduction-to-Data-Science/Week-2/K Rahul Reddy/Assignment 2.txt +++ /dev/null @@ -1,63 +0,0 @@ -1) -Pros: -1. It is easy to read and understand -2. It is an Object oriented programming language -3. It has large standard libraries - -Cons: -1. It is slow -2. It has limitations with database access -3. It is nearly impossible to build high-graphics 3D games - - -2) -Exponential operator(**) - - -3) -// is the floor division operator. It returns the quotient when its operands are divided. Ex: 5//2 = 2 - - -4) -lis = list(input().split(" ")) -n = len(lis) -if(n % 2 == 0): - i = n - 1 -else: - i = n -while i > 0: - del lis[i-1] - i -= 2 -print(lis) - - - -5) -lis = list(input().split(" ")) -n = len(lis) -for i in range (n): - pos = i - for j in range (i + 1, n): - if int(lis[j]) < int(lis[pos]): - pos = j - lis[pos], lis[i] = lis[i], lis[pos] -print(lis) - - - -6) -n = int(input()) -for i in range(n): - m = n - i - 1 - for j in range(m): - print(" ", end = "") - for j in range(2 * i + 1): - print("*", end = "") - print() -for i in range(n - 1): - for j in range(i + 1): - print(" ", end = "") - m = n - i - 1 - for j in range(2 * m - 1): - print("*", end = "") - print() diff --git a/Introduction-to-Data-Science/Week-2/Madhuparna/Assignment2.txt b/Introduction-to-Data-Science/Week-2/Madhuparna/Assignment2.txt deleted file mode 100644 index b4cc908..0000000 --- a/Introduction-to-Data-Science/Week-2/Madhuparna/Assignment2.txt +++ /dev/null @@ -1,73 +0,0 @@ -Q1: -SOLUTION: -pros of python: -1.Easy to code and easy to learn. -2.Lots of resources and Advanced libraries are present in Python . - -cons of Python: -1.It is slow -2.It is not a good choice for memory intensive tasks. - -Q2: -SOLUTION: -The Exponential operator (**) has Highest precedence in an expression. - - -Q3: -SOLUTION: -The operator // is used for floor division. -That is after normal division the floor of the answer is taken. - -Q4: -SOLUTION: -To delete alternate entries of a list -my_list=[1,2,3,4,5,6,7] -s=len(my_list)/2 -for i in range(0 , int(s)): - del my_list[i] - -Q5: -SOLUTION: - -my_list=[3,13,4,1,5,2] -l=len(my_list) -for i in range(0,l): - for j in range(1,l-i): - if my_list[j]list[j]: - temp = list[i] - list[i] = list[j] - list[j] = temp -print("The sorted list is:") -print list - -A6) -n = input('Input n ') -for i in range(1,n+1): - for j in range(0,(2*n)-1-i): - print " ", - for k in range(0,(2*i)-1): - print "*", - print "\n" -for i in range(n-1,0,-1): - for j in range(0,(2*n)-1-i): - print " ", - for k in range(0,(2*i)-1): - print "*", - print "\n" - diff --git a/Introduction-to-Data-Science/Week-2/RohitMP/assignment-2.txt b/Introduction-to-Data-Science/Week-2/RohitMP/assignment-2.txt deleted file mode 100644 index c3da55b..0000000 --- a/Introduction-to-Data-Science/Week-2/RohitMP/assignment-2.txt +++ /dev/null @@ -1,42 +0,0 @@ -1. Pros:It is high-level, interpreted programming language which provides emphas is to code-readability. Code development takes less time as compared to C++ or Java. - Cons:Python code takes more time to execute as compared to C++ or Java. - -2. The exponential operator (**) has the highest precedence in an expression. - -3. The // operator represents floor division. It performs normal division and - then floors the answer and gives the output as an integer. - -4. #Suppose given list is mylist - for i in range(0,len(mylist)): - if(i%2): - print(mylist[i]) - -5. #Suppose given list is mylist - for i in range(0,len(mylist)): - for j in range(1,len(mylist)-i): - if(list[j-1]>list[j]) - temp=list[j-1] - list[j-1]=list[j] - list[j]=temp - -6. -n=input("Enter the value of n\n") -n=int(n) -for i in range(0,n): - for j in range(0,n): - if(i+j>=n-1): - print("*",end="") - else: - print(" ",end="") - for j in range(0,i): - print("*",end="") - print("") -for i in range(0,n-1): - for j in range(0,n): - if(j>i): - print("*",end="") - else: - print(" ",end="") - for j in range(0,n-2-i): - print("*",end="") - print("") diff --git a/Introduction-to-Data-Science/Week-2/S.R.Sahith/assignment_2_data_sciencies.docx b/Introduction-to-Data-Science/Week-2/S.R.Sahith/assignment_2_data_sciencies.docx deleted file mode 100644 index 6be0f70..0000000 Binary files a/Introduction-to-Data-Science/Week-2/S.R.Sahith/assignment_2_data_sciencies.docx and /dev/null differ diff --git a/Introduction-to-Data-Science/Week-2/Shashank/a2.txt b/Introduction-to-Data-Science/Week-2/Shashank/a2.txt deleted file mode 100644 index 03557a8..0000000 --- a/Introduction-to-Data-Science/Week-2/Shashank/a2.txt +++ /dev/null @@ -1,46 +0,0 @@ -1) Pros: Programs written in python are easier to read. It is extremely capable of being used as glue code. -Cons: It might take longer to execute. - -2) The **(exponent) operator has highest priority in an expression. - -3) The '//' operator gives the quotient of the two opearnds after truncating the decimal part. It is the floor division operator. - -4) a=[1,2,3,4,5,6,7,8,9,10] -for i in range(1,10,2): - a.remove(i) -print(a) - -5) a=[6,7,8,5,9,0,4,3,1,2] -i=0 -while(i<9): - s=i - j=i+1 - while(j<10): - if(a[s]>a[j]): - s=j - j+=1 - if(s!=i): - temp=a[i] - a[i]=a[s] - a[s]=temp - i+=1 -print(a) - -6) n=input() -n=int(n) -for i in range(0,n): - for j in range(0,n-i): - print(' ',end='') - for j in range(0,i+1): - print('*',end='') - for j in range(0,i): - print('*',end='') - print('\n') -for i in range(n-1,0,-1): - for j in range(n-i,0,-1): - print(' ',end='') - for j in range(i+1,0,-1): - print('*',end='') - for j in range(i,0,-1): - print('*',end='') - print('\n') diff --git a/Introduction-to-Data-Science/Week-2/aditya-rastogi/assignment2 b/Introduction-to-Data-Science/Week-2/aditya-rastogi/assignment2 deleted file mode 100644 index daf56cb..0000000 --- a/Introduction-to-Data-Science/Week-2/aditya-rastogi/assignment2 +++ /dev/null @@ -1,47 +0,0 @@ -1. -Pros: -a)Python is a high level language, works with interpreters and is thus, platform independent. -b)Pyhton is a very easy to learn language. -c)Object oriented programming language, has great benefits with modularity -Cons: -a) It is very slow in execution as compared to c,c++ or java. -b) limitations with database access. -c) extremely difficult to build a high-graphic 3D game using python -2. -exponentiation operator(**) -eg:-2**3=8 -3. -// is the floor division operator. -It is used to give the floor(round down) of the division rounded to the nearest integer below it. eg:- 10//4 = 2 (not 3 or 2.5) -4. -my_list=[int(x) for x in input("enter the list ").split()] -print(len(my_list)) -mylist=[] -for i in range(0,len(my_list)): - if(i%2 is 0): - mylist.append(my_list[i]) -print(mylist) -5. -my_list=[int(x) for x in input("enter the list ").split()] -for i in range (0,len(my_list)-1): - for j in range(0,len(my_list)-1-i): - if(my_list[j]>my_list[j+1]): - my_list[j],my_list[j+1]=my_list[j+1],my_list[j] -print(my_list) -6. -n = input("enter n ") -n= int(n) -for i in range(0,n): - for j in range(0,n): - if(i+jmy_list[j+1]: - my_list[j],my_list[j+1]=my_list[j+1],my_list[j] -print(my_list) - -6) -for i in range(0,n): - for j in range(0,n-i-1): - print(' ',end='') - for k in range(0,2*i+1): - print('*',end='' ) - print() -for i in range(n-1,0,-1): - for j in range(0,n-i): - print(' ',end='') - for k in range(0,2*i-1): - print('*',end='') - print() -