git.net

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

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


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.