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).
Due to the reasons discussed here we will be moving to python-forum.io on October 1, 2016.

This forum will be locked down and no one will be able to post/edit/create threads, etc. here from thereafter. Please create an account at the new site to continue discussion.
User avatar
micseydel
 
Posts: 2988
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.
Due to the reasons discussed here we will be moving to python-forum.io on October 1st, 2016.
This forum will be locked down and no one will be able to post/edit/create threads, etc. here from thereafter. Please create an account at the new site to continue discussion.
ichabod801
 
Posts: 686
Joined: Sat Feb 09, 2013 12:54 pm
Location: Outside Washington DC


Return to General Coding Help

Who is online

Users browsing this forum: Yahoo [Bot] and 3 guests

cron