jeudi 5 août 2021

Making a choice based on probability - Python

my_list = [1,2,3,4,5,6,7,8,9,10] 

Lets say we have a list like this in Python. I want to continuously print the elements in this list one by one. but I want elements 5 and less than 5 to have an 80% chance of appearing on the screen, and the rest of elements to have a 20% chance of appearing on the screen. How can i do this?




Aucun commentaire:

Enregistrer un commentaire