We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
You can print this without using join. Print has a built in way of doing this.
When you pass multiple values to print, it will print them space-separated by default. You can set the separator to be anything you want, for example to be newline "\n". Using the splat operator will pass a list as multiple arguments:
print(*['%d x %d = %d'%(n,i,n*i)foriinrange(1,11)],sep="\n")
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Day 5: Loops
You are viewing a single comment's thread. Return to all comments →
You can print this without using join. Print has a built in way of doing this. When you pass multiple values to print, it will print them space-separated by default. You can set the separator to be anything you want, for example to be newline "\n". Using the splat operator will pass a list as multiple arguments: