From a050baadafd1509f51cdb37ce3e7baf8080256e7 Mon Sep 17 00:00:00 2001 From: Andrew Guinness Date: Thu, 5 Oct 2017 23:36:43 -0400 Subject: [PATCH] Exercise added --- Ex6.py | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 Ex6.py diff --git a/Ex6.py b/Ex6.py new file mode 100644 index 0000000..8ae4ece --- /dev/null +++ b/Ex6.py @@ -0,0 +1,44 @@ +import os + +os.getcwd() +os.chdir("Intro_Biocom_ND_319_Tutorial6/") + +import pandas +import numpy + +game = pandas.read_table("UWvMSU_1-22-13.txt", sep="\t") + +import matplotlib.pyplot as plt + +WiscScore = game.loc[game['team'] == 'UW', ['score']] +MSUscore = game.loc[game['team'] == 'MSU', ['score', 'time']] + +plt.plot(WiscScore.time, WiscScore,'r-', MSUscore.time,MSUscore,'g-') + +### alternatively ### + +import plotnine as p9 + +x = p9.ggplot(game, aes(x='time', y='score', color = 'factor(team)')) +x+geom_line() + + +### Q2 ### + +N = numpy.random.choice(100) + +guess = int(input("Guess: ")) + +tries = 1 + +while guess != N and tries < 100: + if guess < N: + print("Higher!") + elif guess > N: + print("Lower!") + guess = int(input("Guess: ")) + +if guess == N: + print("Correct!") + +