A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-list/2005-September/336314.html below:

List of integers & L.I.S. (SPOILER)

List of integers & L.I.S. (SPOILER) List of integers & L.I.S. (SPOILER)Bryan Olson fakeaddress at nowhere.org
Fri Sep 9 13:29:29 EDT 2005
n00m wrote:
 > Oh!
 > Seems you misunderstand me!
 > See how the last block in your code should look:
 >
 > for tc in range(10):
 >     _ = stdin.readline()
 >     sequence = [int(ch) for ch in stdin.readline().split()]
 >     supers = supernumbers(sequence)
 >     print len(supers)
 >     for i in supers:
 >          print i,

Ah, I misunderstood the input. I thought they'd run it once for
each of their test cases. Handling exactly ten inputs sucks, so
how about:

while True:
     if not stdin.readline().strip():
         break
     sequence = [int(ch) for ch in stdin.readline().split()]
     supers = supernumbers(sequence)
     print len(supers)
     for i in supers:
         print i,
     print


-- 
--Bryan

More information about the Python-list mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4