I am new to python and I tried to firstly create a new empty file with the help of python, for example:
f=open('new.txt','x') After creating this file, I wanted to write my output, which appears after running the code below, inside of the new.txt file:
for i in range(1,5): for j in range(0,i): print(i,end=' ') print('\n') However, I did not succeed with it using f.write function. Could you please advice me how to make it using f.write or another way?
Thanks in advance for your time and comprehension!