python - How to print the random.randrange number that was selected? -



python - How to print the random.randrange number that was selected? -

can't seem find reply this; example:

health -= random.randrange(0, 5)

how print out (edit: the console) number selected in range show how much health deducted?

it depends want print it... in add-on hope initialized health variable , utilize -= decrease it... if want print console have

print health #python 2.x

or

print(health) #python 3.x

of course of study have store random number selected

rand = random.randrange(0,5) print rand

python

Comments

Popular posts from this blog

Php operator `break` doesn't stop while -

ubuntu - Bash Script to Check That Files Are Being Created -

vim: Search & replace -