subject

Given a file which contains the seat assignments of passengers separated by commas, write two functions: • seat_assignments(filename) should take the name of the file as input, read it, and return the contents of the file as a string. • open_seat(seating) should take the contents of the file and return the seat closest to the front that's still available as a string. NOTE: there will only be one empty seat per row, and the closest row has the smallest number. Seats are strings in the form: number letter availability e. g. Unvailable: "17 c X" Available: "17 co" (the letter o, not the number zero) Sample File Structure: The file will be structured as follows: 16 a X,8 c X, 22 b X,10 c X, 30 d 0,14 b X, 24 e x,7 e x, 12 e X,27 b X,5 b 0,8 d x,14 c X And for this file your code should return: 5 bo Luau uelauil tempial! 1 def seat_assignments(filename): 2 # your code here! 3 pass 4 5 def open_seat(seating): 6 # your code here! 7 pass 8 9 if __name__ == "__main__": LO 11 seats = seat_assignments("seatchart. txt") 12 assertCopen_seat(seats) == "5 b 0")

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 22:00
Which one of the following identifies the primary a purpose of information classification processes? a. define the requirements for protecting sensitive data.b. define the requirements for backing up data.c. define the requirements for storing data.d. define the requirements for transmitting data.
Answers: 2
question
Computers and Technology, 22.06.2019 21:00
So im doing this school challenge and the teachers said whats the average text a student gets a day so i need to get about 20 in a day but dont know how can you guys 2163371293
Answers: 2
question
Computers and Technology, 23.06.2019 01:30
For a typical middle-income family, what is the estimated cost of raising a child to the age of 18? $145,500 $245,340 $304,340 $455,500
Answers: 2
question
Computers and Technology, 23.06.2019 03:50
Iam a bacterium. i cause stomach cramps and diarrhea. i am caused by eating rotten foodssuch as chicken, fish, or eggs. sometimes turtles carry my bacteria.what am i?
Answers: 2
You know the right answer?
Given a file which contains the seat assignments of passengers separated by commas, write two functi...
Questions
question
Mathematics, 19.10.2019 02:30
Questions on the website: 13722359