Hello everyone, I just started doing Python after I learned a little bit of the language in Computer Science class. (A program at my school.) I am making an RPG and just wondering how I implement random values. For example, the player does between 3-5 damage to enemy, and when the system chooses a value, it subtracts from the monster's HP. Thanks alot for helping.
(Dec-19-2016, 12:49 AM)Yoriz Wrote: [ -> ]Use the random module
Okay, but what about number ranges? (3-5, 1-2, etc.)
(Dec-19-2016, 12:53 AM)Yoriz Wrote: [ -> ]Yes
Oh wait I saw. Now how do I make that random value subtract from a variable?
(Dec-19-2016, 01:08 AM)Yoriz Wrote: [ -> ]variable - random_value
Wow! Thanks again!
Now if you don't mind me asking one more... how do you use greater than or less than to compare variables and values? (if variable > 0)
Suggest you take a basic python tutorial
Yes that is correct
if variable > 0:
print('Greater than 0')
if variable < 10:
print('Less than 10')
if 10 > variable > 0:
print('Its between')