From b9ea5f64d4f2201dff088ff9da4dd5beedcaec52 Mon Sep 17 00:00:00 2001 From: mcorley1 <31901815+mcorley1@users.noreply.github.com> Date: Sat, 30 Sep 2017 12:34:51 -0400 Subject: [PATCH 1/4] Add files via upload --- exercise6script.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 exercise6script.py 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 From 633e8f2988cb7da2c157f32097bf0b26df8f8522 Mon Sep 17 00:00:00 2001 From: Abigail Midlige Date: Wed, 4 Oct 2017 12:03:50 -0400 Subject: [PATCH 2/4] Final Answer Part 1 --- exercise6part1.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 exercise6part1.py diff --git a/exercise6part1.py b/exercise6part1.py new file mode 100644 index 0000000..db77571 --- /dev/null +++ b/exercise6part1.py @@ -0,0 +1,23 @@ +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] + \ No newline at end of file From 9b9bc80bccbbd498cce57cf526809a20dbabf3ee Mon Sep 17 00:00:00 2001 From: Abigail Midlige Date: Wed, 4 Oct 2017 12:07:58 -0400 Subject: [PATCH 3/4] Part 1 final --- exercise6part1.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/exercise6part1.py b/exercise6part1.py index db77571..93c2438 100644 --- a/exercise6part1.py +++ b/exercise6part1.py @@ -20,4 +20,6 @@ B.iloc[i+1,2]=MSUscore B.iloc[i+1,0]=scores.iloc[i,0] - \ No newline at end of file + +import matplotlib.pyplot as plt +plt.plot(B.time,B.UWscore,'-r',B.time,B.MSUscore,'g-') From fcfcd2ca478663eb9d8cd9596a623cd4a47da7c2 Mon Sep 17 00:00:00 2001 From: Abigail Midlige Date: Wed, 4 Oct 2017 12:41:46 -0400 Subject: [PATCH 4/4] Guess a number game --- exercise6part2.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 exercise6part2.py 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"