diff --git a/exercise6part1.py b/exercise6part1.py new file mode 100644 index 0000000..93c2438 --- /dev/null +++ b/exercise6part1.py @@ -0,0 +1,25 @@ +import os +import numpy +import pandas + +#set the working directory +scores = pandas.read_csv("UWvMSU_1-22-13.txt", header=0, sep="\t") + +#generate an array with a cumulative score for each team whenever either team scores +A = numpy.zeros((51,3)) #tells python how big we want the table to be. +B = pandas.DataFrame(A,columns=['time','UWscore','MSUscore']) #labels each column + +UWscore=0 +MSUscore=0 +for i in range(0,len(scores),1): + if scores.iloc[i,1] == "UW": + UWscore +=scores.iloc[i,2] + else: + MSUscore +=scores.iloc[i,2] + B.iloc[i+1,1]=UWscore + B.iloc[i+1,2]=MSUscore + + B.iloc[i+1,0]=scores.iloc[i,0] + +import matplotlib.pyplot as plt +plt.plot(B.time,B.UWscore,'-r',B.time,B.MSUscore,'g-') diff --git a/exercise6part2.py b/exercise6part2.py new file mode 100644 index 0000000..0f5bc93 --- /dev/null +++ b/exercise6part2.py @@ -0,0 +1,15 @@ +import numpy +import pandas + +number=numpy.random.choice(range(1,100,1)) +print "I'm thinking of a number between 1 and 100..." + +Guess=0 +while int(Guess) != number: + Guess=raw_input("take a guess") + if int(Guess)number: + print "Lower" + else: + print "Correct" diff --git a/exercise6script.py b/exercise6script.py new file mode 100644 index 0000000..5785f2e --- /dev/null +++ b/exercise6script.py @@ -0,0 +1,19 @@ +import os +import numpy +import pandas + +#set the working directory +scores = pandas.read_csv("UWvMSU_1-22-13.txt", header=0, sep=",") + +#generate an array with a cumulative score for each team whenever either team scores +A=numpy.zeros((51,3)) #tells python how big we want the table to be. +B=pandas.DataFrame(A,columns=['time','Wisconsin','Michigan']) #labels each column + +UWscore=0 +MSUscore=0 +for i in range(2,len(scores),1): + if scores.iloc[i,1] == "UW": + UWscore += A.iloc[i,1] + else: + MSUscore +=A.iloc[i,2] +print A