import random
class Passanger:
def __init__(self, name_pass, bagadge_value, bagadge_quantity):
"""Constructor"""
self.name_pass = name_pass
self.bagadge_value = bagadge_value
self.bagadge_quantity = bagadge_quantity
if __name__ == "__main__":
list_name_pass = ["Иванов","Иванова","Калдыбег","Мухутдинов","Карелов","Анакондов"]
list_bagadge_value = [25,1,4,14,29,35,2,4,25,6,25,3]
list_bagadge_quantity = [1,4,5,1,1,1,1,1,1,4]
list_passangers = []
random.shuffle(list_name_pass)
random.shuffle(list_bagadge_value)
random.shuffle(list_bagadge_quantity)
for i in range(len(list_name_pass)):
list_passangers.append(Passanger(list_name_pass[i],list_bagadge_value[i], list_bagadge_quantity[i]))
print("Подходят под условие:")
for i in list_passangers:
if (i.bagadge_value < 25 and i.bagadge_quantity == 1):
print(i.name_pass, i.bagadge_value, i.bagadge_quantity)
print("")
print("Пассажиры:")
Объяснение:
https://pastebin.com/hNT2m49y
import random
class Passanger:
def __init__(self, name_pass, bagadge_value, bagadge_quantity):
"""Constructor"""
self.name_pass = name_pass
self.bagadge_value = bagadge_value
self.bagadge_quantity = bagadge_quantity
if __name__ == "__main__":
list_name_pass = ["Иванов","Иванова","Калдыбег","Мухутдинов","Карелов","Анакондов"]
list_bagadge_value = [25,1,4,14,29,35,2,4,25,6,25,3]
list_bagadge_quantity = [1,4,5,1,1,1,1,1,1,4]
list_passangers = []
random.shuffle(list_name_pass)
random.shuffle(list_bagadge_value)
random.shuffle(list_bagadge_quantity)
for i in range(len(list_name_pass)):
list_passangers.append(Passanger(list_name_pass[i],list_bagadge_value[i], list_bagadge_quantity[i]))
print("Подходят под условие:")
for i in list_passangers:
if (i.bagadge_value < 25 and i.bagadge_quantity == 1):
print(i.name_pass, i.bagadge_value, i.bagadge_quantity)
print("")
print("Пассажиры:")
for i in list_passangers:
print(i.name_pass, i.bagadge_value, i.bagadge_quantity)
Объяснение:
https://pastebin.com/hNT2m49y