T
T
Tsybry2022-02-15 21:10:25
Python
Tsybry, 2022-02-15 21:10:25

How to do a certain action if a certain option drops out in the randomizer?

How to do a certain action if a certain option drops out in the randomizer?

import random

3_list = ['1','2','3']
6_list = [''4,''5,'6']
print (random.choice(3_list),random.choice(6_list))

How to make, that at loss (let's say 2 3) action was executed?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Daniil Dedinets, 2022-02-15
@donko1

import random

3_list = ['1','2','3']
if random.choice(3_list) == 2 or random.choice(3_list) == 3:
    # your code here

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question