import random print "Hello, and welcome to the Python Learning Group Project. Since I", \ "already know what I'm doing with pretty much all of this, I'm just gonna", \ "do it all in one big file. Ready?\n" age = 0 age += int(raw_input("How old are you? ")) if age < 20 and age > 12: print "\nA teenager, eh?\n" elif age < 13: print "\nNot even a teenager? Wow, you're pretty young to be in this\n", "programming group" else: print "\n20+? Sounds like you're getting up there.\n" mikeys_age = open("mikeys_age.txt", "w+") mikeys_age.write("15") mikeys_age.close() mikeys_age = open("mikeys_age.txt", "r") age = mikeys_age.read() print "Well, I'm Mikey, and I'm", age, "years old.\n\n" print "Now, then, time for a game. I'm gonna think of a number, and you have", \ "guess what it is. If it's too low or high, I'll tell you. We're gonna keep", \ "going until you get it, so you better hope you're lucky. Between 1-1000, go!\n" \ number = random.randrange(1000)+1 guess = int(raw_input("Okay, take your best guess. ")) count = 1 while guess != number: count += 1 if guess > number: guess = int(raw_input("Too high. Guess again. ")) elif guess < number: guess = int(raw_input("Too low. Guess again. ")) number = str(number) guess = str(number) if count == 1: print "Correct! The number was " + number + ", and your guess of " + guess + \ " was perfect. Also, are you hacking? Got it on your first shot. :P" else: print "Correct! The number was " + number + ", and your guess of " + guess + \ " was perfect." raw_input("\n\nPress enter to exit")