<[EMAIL PROTECTED]> wrote
I'm good here. You see I'm doing some online tests for my graduation
and in a test are hundreds of questions. The thing is it doesn't
display
the number of questions left unanswered, But it displays the status
of
questions(answered and unaswered). I copy the unanswered questions
and paste it in console: here a question is displayed in 5 rows, and
I have 20 questions/page.
So you select, witgh the mouse, all of the "unanswered" questions
from the web page and paste that into the raw_input() request in your
python script?
Have you tried just printing the pasted information to the consiole
to make sure it gets read correctly?
However that still confuses me about what your script is trying to do:
a=0
while True:
s=raw_input()
This should read the entire content of the paste buffer.
All 100 lines of text.
a+=1
if s=="finish":
This will only do anything if the pasted text is exactly "finish".
That seems unlikely, I suspect you might have line endings
and other stuff in there too.
print "you have ", ((a-1)/5), " questions left"
print "in", ((a-1)/100), " pages"
But if we assume that the text was "finish" you would then
come into this block which would print out "0 questions left in 0
pages"
until a is greater than 6 and 101 respectively.
I'm beginning to suspect you really want something like
this pseudo code:
s = raw_input('Paste here> ')
for count, line in enumerate(s): pass
print "You have ", count/5," questions left in ", count/100," pages"
Am I close?
--
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld
_______________________________________________
Tutor maillist - [email protected]
http://mail.python.org/mailman/listinfo/tutor