Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #-------------------------------------------------------------------------------
- # Name: Random number guess game
- # Purpose: Create a random number and let user guess it
- #
- # Author: tronds
- #
- # Created: 19.07.2012
- # Copyright: (c) tronds 2012
- # Licence: <your licence>
- #-------------------------------------------------------------------------------
- #!/usr/bin/env python
- start = int(raw_input ("Enter your startpoint: "))
- end = int(raw_input("Enter your endpoint: "))
- import random
- randnum = random.randrange(start,end)
- userguess = int(raw_input("Whats your guess?"))
- while randnum != userguess:
- userguess = int(raw_input("Want another guess? Enter it here!"))
- print "Your guess didn't match the random number"
- print "Your guess was", userguess
- print "Congratulations, your guess was correct !"
Advertisement