Dynamic String Alignment Code My code works for user output alignment to the right side by maximum length of 4 different user input.
I have 2 question.


Is there a simplier way for append method in my code ?
Is there a simplier way for right alignment by maximum legth of 4 different user input.


Thank You for Your Time...

"""
Main purpose of this code is alignment of the user output to the right
"""
# Take Input from User
name = input("Name: ")
surname = input("Surname: ")
age = input("Age: ")
occupation = input("Occupation: ")
person_dict = {"Name": name, "Surname": surname, "Age": age, "Occupation": occupation}

# Calculate Maximum Character Length
len_list1 = []
len_name = len(name)
len_list1.append(len_name)
len_surname = len(surname)
len_list1.append(len_surname)
len_age = len(age)
len_list1.append(len_age)
len_occupation = len(occupation)
len_list1.append(len_occupation)
a = max(len_list1)

# Output
print(f'Name:       {person_dict["Name"]:&gt;{a}}\n'
      f'Surname:    {person_dict["Surname"]:&gt;{a}}\n'
      f'Age:        {person_dict["Age"]:&gt;{a}}\n'
      f'Occupation: {person_dict["Occupation"]:&gt;{a}}'
      )
All the code from len_list1 = [] to a = max(len_list1) can be replaced with:

a = len(max(person_dict.values(), key=len))


max's key parameter is really helpful here. key is called on each element before max checks it. Dictionary's values method is useful here too. If you already have the data in a dictionary, you might as well make use of that fact. 

You could also use a generator expression here to have the same effect:

a = max(len(val) for val in person_dict.values())


Or, since we're just mapping using an existing function, map would be clean here as well:

a = max(map(len, person_dict.values()))


The point is, use iteration constructs to avoid needing to repeat the same code over and over again for different objects.