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

Thomas Jollans tjol at tjol.eu
Sat Oct 6 15:56:09 EDT 2018


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")



More information about the Python-list mailing list