Guess number game created in Python

in #python7 years ago

Are you interested in Python? I do.
Well, if you want to create a script to guess number with computer, you can create the script in Python as follows, enjoy!

#!c:\python27

-- coding:UTF-8 --

print "If necessary,please set the path:%s\n" % '[Environment]::SetEnvironmentVariable("Path","$env:Path;C:\Python27","User")'

import random

Number_Int = int(random.uniform(1,10))

print "Are you ready? Let's begin."
player = raw_input('Hi,what is your name:')

Input_Int = int(input('Please enter an integer number:'))

while Input_Int!=Number_Int:
if Input_Int>Number_Int:
print('Too large')
Input_Int = int(input('Please enter an integer number:'))
if Input_Int<Number_Int:
print('Too small')
Input_Int = int(input('Please enter an integer number:'))
if Input_Int==Number_Int:
print "%s,congratulations!You win!"% player
break

Coin Marketplace

STEEM 0.15
TRX 0.16
JST 0.028
BTC 68855.28
ETH 2441.78
USDT 1.00
SBD 2.38