Sep-24-2019, 12:13 PM
Hi,
I'm doing Hackerrank's challenge "Learn to Code in 30 days" and this is link for the challenge.
However I was trying this :
Regards,
RavCoder
I'm doing Hackerrank's challenge "Learn to Code in 30 days" and this is link for the challenge.
However I was trying this :
#!/bin/python3 import math import os import random import re import sys if __name__ == '__main__': n = int(input()) i = 0 for i in range (1,11): for j in range (n): print ( i * j )but doesn't work and I found the solution :
#!/bin/python3 import math import os import random import re import sys if __name__ == '__main__': n = int(input()) print( *['%d x %d = %d'%(n, i, n*i) for i in range(1, 11)], sep="\n" )My question is that I don't understand the soultion that the only line of code and what are% d and % in Python?
Regards,
RavCoder