-
Notifications
You must be signed in to change notification settings - Fork 10
Kilgore-McCown Exercise 6 Submission #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
kkilgoreND
wants to merge
10
commits into
lyy005:master
Choose a base branch
from
kkilgoreND:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
e721949
Initial commit
pjlmac e1db837
initial commit w/o termination of game
kkilgoreND f59aece
Update Exercis06_Part2.py
kkilgoreND 987e736
Initial commit for Part 1- graph needs work
kkilgoreND 6c03f90
Updated Exercise06_Part2
kkilgoreND f459c3f
I was able to rig the while loop to exit after correct guess.
pjlmac e73bac2
Python scripts for both parts of the exercise
kkilgoreND 65b5aea
Final Python Scripts for Both Parts
kkilgoreND ab520dd
Delete Exercise6-2.py
kkilgoreND 01caedc
incorrect script for part 1- refer to Exercise06_Part1
kkilgoreND File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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!') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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!') | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You may want to put "print('Correct')" within the "if guess == number" so it won't print out "Correct!" when you reach the maximum guesses. |
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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-') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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-') |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job