__________     __ __     __  _______    ________
  / ____/ __ \   / // /    / / / /  _/ |  / / ____/
 / / __/ / / /  / // /_   / /_/ // / | | / / __/
/ /_/ / /_/ /  /__  __/  / __  // /  | |/ / /___
\____/\____/     /_/    /_/ /_/___/  |___/_____/

 --- A GOPHER-LIKE INTERFACE FOR HIVE BLOCKCHAIN ---

Guess number game created in Python

BY: @xiaodehe | CREATED: March 18, 2018, 2:59 a.m. | VOTES: 2 | PAYOUT: $0.00 | [ VOTE ]

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

TAGS: [ #python ] [ #game ] [ #guess ] [ #number ]

Replies

NO REPLIES FOUND.

[ BACK TO TRENDING ] [ BACK TO MENU ]
CMD>