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).
dggriff2
 
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 irc.freenode.net!

Please do not PM members regarding questions which are meant to be discussed publicly. The point of the forum is so that others can benefit from it. We don't want to help you over PMs or emails.
User avatar
micseydel
 
Posts: 1218
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, and C++
Previous serious languages: R, Java, VBA, Lisp, HyperTalk, BASIC
ichabod801
 
Posts: 84
Joined: Sat Feb 09, 2013 12:54 pm
Location: Outside Washington DC


Return to General Coding Help

Who is online

Users browsing this forum: cairo, casevh, D-termined, Google [Bot], Yoriz and 2 guests