In [22]:
names = ["Sunderraman", "Kumari", "Bah", "Oriola", "RAJ"]
phones = ["1234", "567", "0123", "999999", "7777"]
salaries = [120000,150000,2000000,22000,10]
In [28]:
max([len(name) for name in names])
max([len(str(salary)) for salary in salaries])
Out[28]:
7
In [27]:
max_length_name = max([len(name) for name in names])
max_length_phone = max([len(phone) for phone in phones])
max_length_salary = max([len(str(salary)) for salary in salaries])
for (name,phone,salary) in zip(names,phones,salaries):
print(name.ljust(max_length_name),phone.center(max_length_phone),str(salary).rjust(max_length_salary))
Sunderraman 1234 120000 Kumari 567 150000 Bah 0123 2000000 Oriola 999999 22000 RAJ 7777 10
In [3]:
list(zip(names,phones))
Out[3]:
[('Sunderraman', '1234'), ('Kumari', '5678'), ('Bah', '0123'), ('Oriola', '9999')]