Python Forum
Help with list homework
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help with list homework
#1
I have a list that compared from 3 lists that compered from 0,1,2
like that:
[
    [0, 0, 2, 2, 0, 1, 1],
    [1, 0, 0, 0, 1, 0, 0],
    [0, 1, 0, 0, 0, 1, 0]
]
0 can be next to all numbers
1 cant be next to another number
2 can be next to another 2

I tried to do it with the first line unsuccsefully
def verify_seating_arranngment(cinema):
    line_1 = cinema[0]
    line_2 = cinema[1]
    line_3 = cinema[2]
    for i in line_1:
        if i ==1 and i+1== 1:
            return False
    
print(verify_seating_arranngment([
    [0, 0, 2, 2, 0, 1, 1],
    [1, 0, 0, 0, 1, 0, 0],
    [0, 1, 0, 0, 0, 1, 0]
]))

someone can please tall me whats wrong with it?
Yoriz write Nov-17-2022, 08:45 PM:
Please post all code, output and errors (in their entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
Reply


Messages In This Thread
Help with list homework - by eyal123 - Nov-17-2022, 08:40 PM
RE: Help with list homework - by Yoriz - Nov-17-2022, 08:59 PM
RE: Help with list homework - by eyal123 - Nov-18-2022, 11:19 AM
RE: Help with list homework - by deanhystad - Nov-17-2022, 09:17 PM
RE: Help with list homework - by Yoriz - Nov-18-2022, 12:17 PM
RE: Help with list homework - by deanhystad - Nov-18-2022, 03:46 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Homework - List containing tuples containing dicti Men 4 2,086 Dec-28-2021, 12:37 AM
Last Post: Men
  Sorting list - Homework assigment ranbarr 1 2,283 May-16-2021, 04:45 PM
Last Post: Yoriz
  have homework to add a list to a list using append. celtickodiak 2 2,073 Oct-11-2019, 12:35 PM
Last Post: ibreeden
  Dictionary/List Homework ImLearningPython 22 10,813 Dec-17-2018, 12:12 AM
Last Post: ImLearningPython

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020