how can I justify the output of this code?
N = int(input())
case = \'#\'
print(case)
for i in range(N):
case += \'#\'
print(case)
One liner using f-string and join:
print("\n".join([f"{'#' * i:>10}" for i in range(1, 11)]))
Output:
#
##
###
####
#####
######
#######
########
#########
##########
If you would like to include row number you can do following:
print("\n".join([f"{i:<3}{'#' * i:>10}" for i in range(1, 11)]))
Output:
1 #
2 ##
3 ###
4 ####
5 #####
6 ######
7 #######
8 ########
9 #########
10 ##########