When I run the following code, it skips to the end and simply prints "Thanks for playing!"
I'm sure it's something super obvious that I've missed, any ideas? I am using Python 2.7.6.
Thanks.
import random
def roll (sides = 6):
numberRolled = random.randint(1,sides)
return numberRolled
def main():
sides = 6
rolling = True
while rolling:
roll_again = raw_input("Press Enter to roll, or Q to quit.")
if roll_again.lower() != "q":
numberRolled = roll(sides)
print ("You rolled a " + numberRolled)
else:
rolling = False
print ("Thanks for playing!")