Russell Owen :
> I think what I'm looking for is a task-like thing I can create that I
> can end when *I* say it's time to end, and if I'm not quick enough
> then it will time out gracefully. But maybe there's a simpler way to
> do this. It doesn't seem like it should be difficult, but I'm stumped.
Terry Reedy wrote:
> On 10/5/2018 4:48 PM, ts9...@gmail.com wrote:
> > I am new to Python programming but have significant SQL and C experience.
> My simple question is,"Why not standardize Python indentations to 3 spaces
> instead of 4 in order to avoid potential programming errors associated
Bruce,
I completely agree; it is worth everyone remember that we are all here
(even the moderators) as volunteers; we are here because either we want
to ask questions, or we want to learn, or we want to help.
We do need to remember that the moderators is here to be nasty or
because of a powe
Hi, I am new to python and would like someones help on the following:
After rolling 5 dice and putting the results into a list, I need to check if
any dice is not a 1 or 5.
if all dice in the list are either a 1 or 5 , I want to calculate a result.
if there is a 2,3,4 or 6 in the list i want to
On 2018-10-06 19:10, eliteanarchyra...@gmail.com wrote:
Hi, I am new to python and would like someones help on the following:
After rolling 5 dice and putting the results into a list, I need to check if
any dice is not a 1 or 5.
if all dice in the list are either a 1 or 5 , I want to calculate
On 06/10/2018 20:10, eliteanarchyra...@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
You could use any and a generator expression.
It sounds pretty hard, but it's actually easily expressed, and pretty
intelligible.
Here you go:
if any(n in result for n in [2, 3, 4, 6]):
# reroll
else:
# do your thing
-
Arma
On Sat, 06 Oct 2018 21:56:09 +0200, Thomas Jollans wrote:
> On 06/10/2018 20:10, eliteanarchyra...@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")
>
Well these worked like a charm. Cant say I understand some of them and will
have to look into utilizing them in the future, but I appreciate everyones
responses and thank you all. Never needed to check for multiple instances in a
list before.
Nice to have help!
--
https://mail.python.org/mailm
# your program is quite complicated. classes are overkill. A simpler
solution is:
import random
for i in range(5):
roll = random.randint(1,6)
if roll not in (1,5):
print('you can roll again')
break
else:
print("you have all 1's and 5's in your result'")
# comments on
10 matches
Mail list logo