Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def find_longest(list_of_words):
- return len(max(list_of_words, key=len))
- def flush_right(list_of_words, file_name):
- n = find_longest(list_of_words) +3
- with open(file_name,'w') as file:
- for word in list_of_words:
- file.write(word[::-1].rjust(n) + '\n')
- def main():
- list_of_words = ["Ala", "ma", "kota"]
- name_of_file = 'test.txt'
- flush_right(list_of_words, name_of_file)
- if __name__ == "__main__":
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement