tronds icon

Random number guess game in Python

tronds | PRO | 07/20/12 04:34:47 PM UTC | 0 ⭐ | 262 👁️ | Never ⏰ | []
Python |

840 B

|

None

|

0 👍

/

0 👎

#-------------------------------------------------------------------------------
# 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 !"

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎