osdir.com

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Creating dice game : NEED HELP ON CHECKING ELEMENTS IN A LIST


On 06/10/2018 20:10, eliteanarchyracer at gmail.com wrote:
> # ----- THIS LINE IS WHERE I NEED HELP ---- # ( if 2, 3, 4, 6 in list: )
>      print("you can roll again")
> else:
>      print("you have all 1's and 5's in your result")
> 

You can use a loop:

for good_number in [2,3,4,6]:
     if good_number in result:
         print("you can roll again")
         break
else:
     print("you have all 1's and 5's in your result")