diff --git a/Exercis06_Part2.py b/Exercis06_Part2.py new file mode 100644 index 0000000..f426168 --- /dev/null +++ b/Exercis06_Part2.py @@ -0,0 +1,19 @@ +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!') \ No newline at end of file diff --git a/Exercise06_Complete b/Exercise06_Complete new file mode 100644 index 0000000..ead3bd1 --- /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(misspelled when naming the file) + +#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!') 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 diff --git a/Exercise6-1.py b/Exercise6-1.py new file mode 100755 index 0000000..379ebba --- /dev/null +++ b/Exercise6-1.py @@ -0,0 +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-')