Code:
for i in range(2, 21):
for j in range(1, 11):
with open(f"tables/Multiplication_table_of_{i}.txt", 'w') as f:
f.write(f"{i}X{j}={i*j}")
if j!=10:
f.write('\n')
By using the above code I'm unable to write the complete table. It gives only values like 2X10, 3X10 , 4X10 and etc. and not the entire table.
Whereas the code given below writes the whole table,
for i in range(2, 21):
with open(f"tables/Multiplication_table_of_{i}.txt", 'w') as f:
for j in range(1, 11):
f.write(f"{i}X{j}={i*j}")
if j!=10:
f.write('\n')
Can anyone please explain me what's happening??? I'm unable to iterate the code.