
I want to know how I can write result in the file. This is my homework. I hope someone help me.
Thank you.

I want to know how I can write result in the file. This is my homework. I hope someone help me.
Thank you.
Do not use print, instead assign that to a variable
text = 'something {} here'.format(where)
print(text) # if you still want to print
f.write(text)