diff --git a/EX_8 b/EX_8 new file mode 100644 index 0000000..d888f69 --- /dev/null +++ b/EX_8 @@ -0,0 +1,36 @@ +#1 Sports cumulative scores +import pandas as pd +import numpy as np +import matplotlib.pyplot as plt +gamedata=pd.read_csv('gamedata.csv', sep='\s+') +UW=gamedata[gamedata.team.str.contains('UW')] +print UW +MSU=gamedata[gamedata.team.str.contains('MSU')] +print MSU +UW_cumsum=np.cumsum(UW.score) +UW_time=UW.time +UW_time +MSU_cumsum=np.cumsum(MSU.score) +MSU_time=MSU.time +plt.plot(UW_time,UW_cumsum,'r-',MSU_time,MSU_cumsum,'g-') +plt.ylabel('Cumulative Score') +plt.xlabel('Time') +plt.legend() +plt.show() +#2 Guess My Number Game +import random +number=random.randint(1,100) +print 'I\'m thinking of a number between 1 and 100. Guess what it is!' +guess=int(raw_input("Guess:")) +while random != "guess": + print + if guessnumber: + print "Lower" + guess=int(raw_input("Guess:")) + else: + print "Correct!" + break + diff --git a/exercise_2 b/exercise_2 new file mode 100644 index 0000000..63acf6f --- /dev/null +++ b/exercise_2 @@ -0,0 +1,15 @@ +import random +number=random.randint(1,100) +print 'I\'m thinking of a number between 1 and 100. Guess what it is!' +guess=int(raw_input("Guess:")) +while random != "guess": + print + if guessnumber: + print "Lower" + guess=int(raw_input("Guess:")) + else: + print "Correct!" + break