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

Alister alister.ware at ntlworld.com
Sat Oct 6 16:48:18 EDT 2018


On Sat, 06 Oct 2018 21:56:09 +0200, Thomas Jollans wrote:

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

or simply check for 1 & 5 to exit otherwise continue



-- 
Someone hooked the twisted pair wires into the answering machine.



More information about the Python-list mailing list