Skip to content

Instantly share code, notes, and snippets.

@avadhootkulkarni
Last active August 29, 2015 14:21
Show Gist options
  • Save avadhootkulkarni/c3c89473d84bf574eab2 to your computer and use it in GitHub Desktop.
Save avadhootkulkarni/c3c89473d84bf574eab2 to your computer and use it in GitHub Desktop.
simple 200 score bowling script in python
print "Welcome to Bowling single player game."
print """
\nRules
\nYou're given 10 chances.
\nRecord the score once you bowl.
\nIf you hit a 10 i.e. have a strike, you get one more chance to bowl.
\nExcited? Let's get started.
"""
prev_score = 0
strike = 0
scoreList = []
def next_chance():
for i in xrange(1, 11, 1):
print "Chance number %d" % i
print "\nRecord the score"
score = int(raw_input("> "))
if score == 10:
print "Strike. One more chance. Record the score"
strike = int(raw_input("> "))
elif score > 10:
print "More than 10? Not possible, buddy. :D Try again."
strike = int(raw_input("> "))
else:
strike = 0
prev_score = score + strike
scoreList.append(prev_score)
next_chance()
print scoreList
print "Total score is %d" % sum(scoreList)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment