-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuse_airtravel.py
More file actions
54 lines (45 loc) · 1.4 KB
/
Copy pathuse_airtravel.py
File metadata and controls
54 lines (45 loc) · 1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
"""
Use flight class
"""
from airtravel import Flight, Aircraft
from pprint import pprint as pp
def make_flight():
flight = Flight("SN066",
Aircraft("G-EUP",
"Airbus A319",
num_rows=22,
num_seats_per_row=6))
# pp(flight._seating)
flight.allocate_seat("02A", "Guido Van Rossum") # python
flight.allocate_seat("12B", "Rasmus Lerdorf") # php
flight.allocate_seat("15F", "Bjare Stroustrup") #C++
flight.allocate_seat("03A", "Larry Wall") # perl
flight.allocate_seat("16F", "Yukihiro Matsumoto") # ruby
return flight
def console_card_printer(passenger, seat, flight_number, aircraft):
output = "| Name: {0}" \
" Flight: {1} " \
" Seat: {2}" \
" Aircraft: {3}" \
" |".format(passenger, flight_number,
seat, aircraft)
banner = "+" + "-" * (len(output) - 2) + "+"
border = "|" + " " * (len(output) - 2) + "|"
lines = [banner, border, output, border, banner]
card = '\n'.join(lines)
print(card)
print()
def main():
"""
Test function
:return:
"""
flight_1 = make_flight()
pp(flight_1._seating)
print("Available seats",
flight_1.num_available_seats())
flight_1.make_boarding_class(
console_card_printer)
if __name__ == '__main__':
main()
exit(0)