Hi. I'm trying to include things such as chance in Python, what i'm trying to do is take an integer, and make that integer into a percentage, and from that percentage and change the outcome of something based on the result.
For example, lets say i want to have something happen 50% of the time, and the other 50% of the time, something else happens, for example, printing the word "yes" or the word "no" based on the outcome of the chance.
How do you include things such as chance in your Python code?
Hi. I'm trying to include things such as chance in Python, what i'm trying to do is take an integer, and make that integer into a percentage, and from that percentage and change the outcome of something based on the result.
For example, lets say i want to have something happen 50% of the time, and the other 50% of the time, something else happens, for example, printing the word "yes" or the word "no" based on the outcome of the chance.
try
yes
asno
, then you could do something like this:Please upvote if this helps :)
check out tic tac toe with bots