range_end = int(input("Enter the range end (e.g., 100): ")) numbers_per_line = int(input("Enter the number of values per line: ")) for i in range(1, range_end + 1): print("{:3}".format(i), end=" ") if i % numbers_per_line == 0: print()