Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Simple script
nbowlers = 5
nscores = 3
team_score = 0
for bowlernum in range(nbowlers):
bowler_scores = []
for game_num in range(nscore):
prompt_string = “Please enter Bowler %i’s game score in game %i: \n” % (bowlernum+1, game_num+1) #because counting starts at zero
score = int(raw_input(prompt_string))
bowler_scores.append(score) #keep track of this bowler
team_score += score #keep track of team
print 'Bowler %i had scores of: %s' % str(bowler_scores)
bowler_avg = sum(bowler_scores)/nscores
print 'Bowler %i had an average score of %f' % (bowler_num+1, bowler_avg)
team_avg = team_score/(nbowlers*nscores)
print "The team average is %f" % team_avg
#table stuff
populations = [5000] #starting with 5,000 people
food = [10000] #and food for 10,000
for year in range(50):
cur_pop = populations[-1]
next_pop = cur_pop*1.5 #getting bigger by 50%
cur_food = food[-1]
next_food = cur_food*1.2 #only grows by 20%
if next_food < cur_pop:
print zip(populations, food)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.