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, 22.06.2019 15:10
Consider a direct-mapped cache with 216 words in main memory. the cache has 16 blocks of 8 words each. it is a word-addressable computer (rather than a byte-addressable computer which we normally discuss). (a) how many blocks of main memory are there? (b) what is the format of a memory address as seen by the cache, that is, what are the sizes of the tag, cache block, and block offset fields (if they apply)? (c) to which cache block will the memory reference db6316 map?
Answers: 1
question
Computers and Technology, 22.06.2019 15:50
The file sales data.xlsx contains monthly sales amounts for 40 sales regions. write a sub that uses a for loop to color the interior of every other row (rows 3, 5, etc.) gray. color only the data area, columns a to m. (check the file colors in excel.xlsm to find a nice color of gray.)
Answers: 2
question
Computers and Technology, 22.06.2019 20:00
When you mouse over and click to add a search term this(these) boolean operator(s) is(are) not implied. (select all that apply)?
Answers: 1
question
Computers and Technology, 22.06.2019 21:40
Develop a function to create a document in the mongodb database “city” in the collection “inspections.” be sure it can handle error conditions gracefully. a. input -> argument to function will be set of key/value pairs in the data type acceptable to the mongodb driver insert api call b. return -> true if successful insert else false (require a screenshot)
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
Physics, 27.02.2020 18:20
question
English, 27.02.2020 18:20
question
Mathematics, 27.02.2020 18:20
question
Mathematics, 27.02.2020 18:22
Questions on the website: 13722363