Advertisement
here2share

# b_print_each_at_x.py

Mar 25th, 2023 (edited)
1,020
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.31 KB | None | 0 0
  1. # b_print_each_at_x.py
  2.    
  3. def print_each_at_x(vars_list, n=20):
  4.     for var in vars_list:
  5.         print(f"{var:<{n}}", end="")
  6.     print()   # to print a new line at the end
  7.  
  8. # Example usage:
  9. var1 = "Hello"
  10. var2 = "Wonderful World"
  11. var3 = "!!!"
  12. vars_list = [var1, var2, var3]
  13. print_each_at_x(vars_list)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement