Дан список:
users_list = [
('Александр', 'ru'),
('James', 'us'),
('Daniella', 'es'),
('Someone', 'unknown country'),
]
Привет, Александр!
Hello, James!
Hola, Daniella!
Hello, Someone, but I do not know where are you from!
Без map сделал так:
users_list = [
('Александр', 'ru'),
('James', 'us'),
('Daniella', 'es'),
('Someone', 'unknown country'),
]
list_1 = list()
list_2 = list()
for i in users_list:
list_1.append(i[0])
list_2.append(i[1])
def res():
for a in list_2:
if a == "ru":
b = "Привет, "
print(b, list_1[0],"!", sep="")
elif a == 'us':
b = "Hello, "
print(b, list_1[1],"!", sep="")
elif a == 'es':
b = 'Hola, '
print(b, list_1[2],"!", sep="")
elif a == 'unknown country':
b = 'Someone,'
print(b, list_1[3],"but I do not know where are you from!")
res()