You accidentally sent your response to me instead of the list. The
proper thing to do for nearly all messages is to respond to the list.
The main exception for that is if you just want to leave a simple
thank-you for a person, and nothing of interest to anyone else.
From your email program, use Reply-List. If it doesn't support that,
use Reply-All, and then delete me, so it goes just to the list.
Another problem with your message is messed-up formatting, apparently
caused by the fact that you're sending html-encoded email to a text-only
mailing list. Please tell your mailer to use text.
On 05/04/2015 10:07 PM, yvan moses levy wrote:> Le 04/05/15 13:00, Dave
Post by yvan moses LevyPost by Dave AngelYou'd find it a lot easier to get responses if you'd say in what way
the code
Post by yvan moses LevyPost by Dave Angelis wrong. If you get an exception, show the full traceback. If you get
printed results, show what you expected, and what you got instead.
If it
Post by yvan moses LevyPost by Dave Angelhung, or crashed the OS, or ran out of memory, say so.
Post by yvan moses LevyI tried and tried
But I'm very isolated and It's hard without consultation with a tutor
<code>from math import sqrt
bigList = [False, False] + [True]*100
print("line 4 - bigList : ", bigList)
print("line 6 - num : ", num)
What did you expect this to do? What is bigList[2] ? What is
bigList[int(sqrt(num)) + 1] ? Are these reasonable values to put into a
range() function?
You didn't answer any of these questions. Why not?
Post by yvan moses LevyPost by Dave AngelPost by yvan moses Levyprint("line 8 x : %d"%x)
print("line 10 {0} divise par {1} = {2} ".format(num, x, num/x))
bigList[num] == False
print "bigList[{0} == {1}]".format(num, bigList[num])
bigList[num] == True
bigList[multiple] = False
return(bigList)
print("the last result of bigList {} ".format(holeofStrainer()))</code>
I WANT TO KNOW WHILE THE EXECUTION DO NOT GOING DOWNWARD
OK I'll trying
<code>from math import sqrt
"""The purpose is to build a sieve of Erasthotenes.
We beginn with a sieve without holes, called biglist.
First, The natural list indexation. II-st, there are
as keys of the corresponding list items(the boolean
values of the prime being question about each number).
We have for each index a"""
bigList = [False, False] + [True]*100
print("line 11 - bigList : ", bigList)
print("line 13 - num : ", num)
# I f we don't find divisors of nume littler that sqrt(num)
# it is guaranted that num is prime.
# 'int(sqrt(num)) + 1' is the first integer greater than sqrt(num)
I repeat, what did you expect this line to do? Examine this line
carefully. Print out the two expressions you're passing to range().
This currently loops from True to True, or from False to False, so it
skips the whole predicate. Think about what you really want the loop to do.
Post by yvan moses Levyprint("line 18 x is equal to %d"%x)
print("line 20 {0} divided by {1} = {2} ".format(num, x,
num/x))
Post by yvan moses LevybigList[num] == False
print ("bigList index {0} == {1}".format(num, bigList[num]))
bigList[num] == True
bigList[multiple] = False
return(bigList) #We expect a 'sieve with many holes'
print("the last result of bigList {} ".format(holeofStrainer()))</code>*
*
***Hi Dave.*
What's the reason you're quad-spacing the expected output? I'm fixing
it, but it's a pain to do.
Post by yvan moses Levy**
Post by Dave Angel*I expected to obtain an output as:*
*line 13 num 3*
*line 18 x :2*
*line 20: 3 divided by 2 is equal to 1.5*
*biglist index 3 == True*
*line 13 num 4*
*line 18 x:2*
*line 20 4 divided by 2 is equal to 2*
*biglist index 4 == False*
So that's what you expected. What did you get instead? If you notice
that line 18 never printed, shouldn't you guess that something's wrong
with the loop in line 17?
--
DaveA
_______________________________________________
Tutor maillist - ***@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor