How can I iterate through my arguments to print these lines out for each of the arguments in my function, instead of typing each of them out?
def validate_user(surname, username, passwd, password, errors):
errors = []
surname = surname.strip() # no digits
if not surname:
errors.append('Surname may not be empty, please enter surname')
elif len(surname) > 20:
errors.append('Please shorten surname to atmost 20 characters')
username = username.strip()
if not username:
errors.append('Username may not be empty, please enter a username')
elif len(surname) > 20:
errors.append('Please shorten username to atmost 20 characters')