From e72194947ffb8c7e0ddd50b172fb7188fec82068 Mon Sep 17 00:00:00 2001 From: Phil McCown Date: Fri, 29 Sep 2017 11:22:51 -0400 Subject: [PATCH 01/10] Initial commit --- Exercise6-1.py | 7 +++++++ Exercise6-2.py | 0 2 files changed, 7 insertions(+) create mode 100755 Exercise6-1.py create mode 100755 Exercise6-2.py diff --git a/Exercise6-1.py b/Exercise6-1.py new file mode 100755 index 0000000..d87ffda --- /dev/null +++ b/Exercise6-1.py @@ -0,0 +1,7 @@ +import pandas +import matplotlib.pyplot as plt +bball=pandas.read_table('UWvMSU_1-22-13.txt',delim_whitespace=True) +UW=bball[bball.team=='UW'] +MSU=bball[bball.team=='MSU'] + +plt.plot('UWscore','r-','MSUscore','g-') \ No newline at end of file diff --git a/Exercise6-2.py b/Exercise6-2.py new file mode 100755 index 0000000..e69de29 From e1db837827aa988fc594ac3a291dcbcdea1f08f9 Mon Sep 17 00:00:00 2001 From: kkilgoreND <31992787+kkilgoreND@users.noreply.github.com> Date: Fri, 29 Sep 2017 11:45:26 -0400 Subject: [PATCH 02/10] initial commit w/o termination of game --- Exercis06_Part2.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 Exercis06_Part2.py diff --git a/Exercis06_Part2.py b/Exercis06_Part2.py new file mode 100644 index 0000000..8db188e --- /dev/null +++ b/Exercis06_Part2.py @@ -0,0 +1,17 @@ +import random +guessesTaken=0 +number= random.randint(1,100) +print('I am thinking of a number between 1 and 100') +while guessesTaken <6: + print('Make a guess') + guess= input() + guess= int(guess) + + guessesTaken= guessesTaken + 1 + + if guess < number: + print ('Too low') + if guess > number: + print ('Too high') + if guess == number: + print('Good job!') From f59aece6223a583000786b3dddf71aad9aab9ed5 Mon Sep 17 00:00:00 2001 From: kkilgoreND <31992787+kkilgoreND@users.noreply.github.com> Date: Fri, 29 Sep 2017 11:48:18 -0400 Subject: [PATCH 03/10] Update Exercis06_Part2.py --- Exercis06_Part2.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Exercis06_Part2.py b/Exercis06_Part2.py index 8db188e..aea8a67 100644 --- a/Exercis06_Part2.py +++ b/Exercis06_Part2.py @@ -2,6 +2,7 @@ guessesTaken=0 number= random.randint(1,100) print('I am thinking of a number between 1 and 100') + while guessesTaken <6: print('Make a guess') guess= input() @@ -10,8 +11,8 @@ guessesTaken= guessesTaken + 1 if guess < number: - print ('Too low') + print ('Higher') if guess > number: - print ('Too high') + print ('Lower') if guess == number: - print('Good job!') + print('Correct!') From 987e7364eade0ddfc74b663cb7a1fce038fc120a Mon Sep 17 00:00:00 2001 From: kkilgoreND <31992787+kkilgoreND@users.noreply.github.com> Date: Fri, 29 Sep 2017 13:18:39 -0400 Subject: [PATCH 04/10] Initial commit for Part 1- graph needs work --- Exercise06_Part1.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 Exercise06_Part1.py diff --git a/Exercise06_Part1.py b/Exercise06_Part1.py new file mode 100644 index 0000000..ae818ad --- /dev/null +++ b/Exercise06_Part1.py @@ -0,0 +1,23 @@ +import pandas +import matplotlib.pyplot as plt + +#create new dataframe of the raw data +bball= pandas.read_table('UWvMSU_1-22-13.txt',delim_whitespace=True) + +#setting running cumulative scores for both teams +UWscore = [0] +MSUscore = [0] +time = [0] + +#loop to match scores with teams +for i in range(0, bball.shape[0], 1): + if bball.team[i] == 'UW': + UWscore.append(UWscore[-1]+bball.score[i]) + MSUscore.append(MSUscore[-1]) + elif bball.team[i] == 'MSU': + MSUscore.append(MSUscore[-1]+bball.score[i]) + UWscore.append(UWscore[-1]) + time.append(bball.time[i]) + +#Line plot of both teams where 'r-' is a red line for UW and 'g-' is a green line for MSU +plt.plot(time, UWscore, 'r-', time, MSUscore, 'g-') \ No newline at end of file From 6c03f90629ecd6d8783d6014a5c703273dc169cf Mon Sep 17 00:00:00 2001 From: kkilgoreND <31992787+kkilgoreND@users.noreply.github.com> Date: Fri, 29 Sep 2017 13:23:22 -0400 Subject: [PATCH 05/10] Updated Exercise06_Part2 --- Exercis06_Part2.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Exercis06_Part2.py b/Exercis06_Part2.py index aea8a67..ad19fad 100644 --- a/Exercis06_Part2.py +++ b/Exercis06_Part2.py @@ -4,7 +4,7 @@ print('I am thinking of a number between 1 and 100') while guessesTaken <6: - print('Make a guess') + print('Guess') guess= input() guess= int(guess) From f459c3f064867809d261821cc94fbded6378773e Mon Sep 17 00:00:00 2001 From: Phil McCown Date: Fri, 29 Sep 2017 14:49:55 -0400 Subject: [PATCH 06/10] I was able to rig the while loop to exit after correct guess. --- Exercis06_Part2.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Exercis06_Part2.py b/Exercis06_Part2.py index ad19fad..f426168 100644 --- a/Exercis06_Part2.py +++ b/Exercis06_Part2.py @@ -3,7 +3,7 @@ number= random.randint(1,100) print('I am thinking of a number between 1 and 100') -while guessesTaken <6: +while guessesTaken <10: print('Guess') guess= input() guess= int(guess) @@ -15,4 +15,5 @@ if guess > number: print ('Lower') if guess == number: - print('Correct!') + break +print('Correct!') \ No newline at end of file From e73bac22209537ce2415f1021e8627515790a373 Mon Sep 17 00:00:00 2001 From: kkilgoreND <31992787+kkilgoreND@users.noreply.github.com> Date: Fri, 29 Sep 2017 17:26:59 -0400 Subject: [PATCH 07/10] Python scripts for both parts of the exercise --- Exercise06_Complete | 49 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 Exercise06_Complete diff --git a/Exercise06_Complete b/Exercise06_Complete new file mode 100644 index 0000000..2b9a194 --- /dev/null +++ b/Exercise06_Complete @@ -0,0 +1,49 @@ +#To see history of edits please refer to the python scripts labelled Exercise06_Part1 and Exercis06_Part2 + +#For Part 1 + +import pandas +import matplotlib.pyplot as plt + +#create new dataframe of the raw data +bball= pandas.read_table('UWvMSU_1-22-13.txt',delim_whitespace=True) + +#setting running cumulative scores for both teams +UWscore = [0] +MSUscore = [0] +time = [0] + +#loop to match scores with teams +for i in range(0, bball.shape[0], 1): + if bball.team[i] == 'UW': + UWscore.append(UWscore[-1]+bball.score[i]) + MSUscore.append(MSUscore[-1]) + elif bball.team[i] == 'MSU': + MSUscore.append(MSUscore[-1]+bball.score[i]) + UWscore.append(UWscore[-1]) + time.append(bball.time[i]) + +#Line plot of both teams where 'r-' is a red line for UW and 'g-' is a green line for MSU +plt.plot(time, UWscore, 'r-', time, MSUscore, 'g-') + +#For Part 2 + +import random +guessesTaken=0 +number= random.randint(1,100) +print('I am thinking of a number between 1 and 100') + +while guessesTaken <10: + print('Guess') + guess= input() + guess= int(guess) + + guessesTaken= guessesTaken + 1 + + if guess < number: + print ('Higher') + if guess > number: + print ('Lower') + if guess == number: + break +print('Correct!') From 65b5aeab51cae66fcd5b856bb0137f4baa0417fa Mon Sep 17 00:00:00 2001 From: kkilgoreND <31992787+kkilgoreND@users.noreply.github.com> Date: Fri, 29 Sep 2017 17:28:26 -0400 Subject: [PATCH 08/10] Final Python Scripts for Both Parts --- Exercise06_Complete | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Exercise06_Complete b/Exercise06_Complete index 2b9a194..ead3bd1 100644 --- a/Exercise06_Complete +++ b/Exercise06_Complete @@ -1,4 +1,4 @@ -#To see history of edits please refer to the python scripts labelled Exercise06_Part1 and Exercis06_Part2 +#To see history of edits please refer to the python scripts labelled Exercise06_Part1 and Exercis06_Part2(misspelled when naming the file) #For Part 1 From ab520dd202ecf1603b50d20d50d37a888d4c524a Mon Sep 17 00:00:00 2001 From: kkilgoreND <31992787+kkilgoreND@users.noreply.github.com> Date: Fri, 29 Sep 2017 17:28:56 -0400 Subject: [PATCH 09/10] Delete Exercise6-2.py --- Exercise6-2.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100755 Exercise6-2.py diff --git a/Exercise6-2.py b/Exercise6-2.py deleted file mode 100755 index e69de29..0000000 From 01caedce623956908ea18a6d906f2d82edd89753 Mon Sep 17 00:00:00 2001 From: kkilgoreND <31992787+kkilgoreND@users.noreply.github.com> Date: Fri, 29 Sep 2017 17:32:36 -0400 Subject: [PATCH 10/10] incorrect script for part 1- refer to Exercise06_Part1 --- Exercise6-1.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Exercise6-1.py b/Exercise6-1.py index d87ffda..379ebba 100755 --- a/Exercise6-1.py +++ b/Exercise6-1.py @@ -1,7 +1,9 @@ +#Early working of part 1-not complete or correct + import pandas import matplotlib.pyplot as plt bball=pandas.read_table('UWvMSU_1-22-13.txt',delim_whitespace=True) UW=bball[bball.team=='UW'] MSU=bball[bball.team=='MSU'] -plt.plot('UWscore','r-','MSUscore','g-') \ No newline at end of file +plt.plot('UWscore','r-','MSUscore','g-')