From aa530b2d27f35e88b275394ea6c6c36343e86f7b Mon Sep 17 00:00:00 2001 From: Helen Date: Tue, 30 Oct 2018 16:44:20 -0400 Subject: [PATCH 1/2] My answer for problem #2 --- exercise_2 | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 exercise_2 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 From 2a0a53a617af676f4721912ba86799ce57c89e9b Mon Sep 17 00:00:00 2001 From: Helen Date: Wed, 31 Oct 2018 17:45:11 -0400 Subject: [PATCH 2/2] My answers for exercise 8 --- EX_8 | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 EX_8 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 +