0
How to print a table upto 10 of any number given by user
3 Respostas
+ 10
# Python 3
def mult_table(n):
for i in range(1,11):
print(f'{n} x {i} = {n*i}')
mult_table(int(input('Enter a number to get its multiplication table: ')))
+ 9
Hrishi Gothe It's a new functionality of Python3. It's called "f-string" (stands for "format string").
To learn more about this way of formatting, check out this wonderful blog post: https://realpython.com/JUMP_LINK__&&__python__&&__JUMP_LINK-f-strings/
+ 1
but why you used print(f'{n}.....
why f is used here