Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions exercise6part1.py
Original file line number Diff line number Diff line change
@@ -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-')

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job

15 changes: 15 additions & 0 deletions exercise6part2.py
Original file line number Diff line number Diff line change
@@ -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 "Higher"
elif int(Guess)>number:
print "Lower"
else:
print "Correct"

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job

19 changes: 19 additions & 0 deletions exercise6script.py
Original file line number Diff line number Diff line change
@@ -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