Skip to main content
2 of 4
deleted 27 characters in body
Rahul K P
  • 16.1k
  • 4
  • 37
  • 54

Ruler printing can be down by pretty small function like this,

def print_ruler(n):
    print('|....'*(n-1)+'|')
    print(''.join(f'{i}    ' for i in range(1,n+1)))

Execution:

In [1]: print_ruler(5)
|....|....|....|....|
1    2    3    4    5    

In [2]: print_ruler(10)
|....|....|....|....|....|....|....|....|....|
1    2    3    4    5    6    7    8    9    10    
Rahul K P
  • 16.1k
  • 4
  • 37
  • 54