Finding blocks of available seats on a row

This is the place for queries that don't fit in any of the other categories.

Finding blocks of available seats on a row

Postby dggriff2 » Sat Feb 23, 2013 7:37 pm

I would like to know if someone can tell me a solution for the following problem.

If I have the following list

row = [a1, a2, a3, a4, a5, xx, a7, a8, a9, a10]

This is effectively a row at a cinema or theatre. I would like to write a program that is able to find blocks of available seats for this row (xx is an unavailable seat). For example If I wanted a block of 5 seats my program would say that they are available and would return a1-a5.

Any help with this would be greatly appreciated.

Thanks in advance.
Last edited by micseydel on Sat Feb 23, 2013 7:48 pm, edited 1 time in total.
Reason: Locked as it looks like homework (so no need to quote).
Posts: 1
Joined: Sat Feb 23, 2013 7:25 pm

Re: Finding blocks of available seats on a row

Postby micseydel » Sat Feb 23, 2013 7:51 pm

It doesn't look like you've read this. Please read it, and then provide the needed information, and feel free to ask questions (if after reading that, you're still not sure what we want).
Join the #python-forum IRC channel on for off-topic chat!

Please prefer not to PM members. The point of the forum is so that anyone can benefit. We don't want to help you over PMs/emails/Skype chats that others can't benefit from :)
User avatar
Posts: 2921
Joined: Tue Feb 12, 2013 2:18 am
Location: Mountain View, CA

Re: Finding blocks of available seats on a row

Postby ichabod801 » Sat Feb 23, 2013 8:24 pm

And that row variable is poorly specified. I'm assuming the seats are meant to be represented by strings, in which case they should be in quotes.
Craig "Ichabod" O'Brien
Minimalist, buddhist, theist, and programmer
Current languages: Python, SAS, C++
Previous serious languages: Erlang, R, Java, VBA, Lisp, HyperTalk, BASIC
Posts: 645
Joined: Sat Feb 09, 2013 12:54 pm
Location: Outside Washington DC

Return to General Coding Help

Who is online

Users browsing this forum: No registered users and 8 guests