Trying to create a read/write file but keep getting invalid syntax errors : <p>Whenenver I try to run the code in python IDLE, it gives me a syntax error for the first line, not sure why. Trying to get the code to write onto a text document for the lab  </p>

<pre><code>Rfile=open (r 'C:\\Users\\cgeeg\\Desktop\\New_folder\\receipt.txt' )

file.write('Name:' )
file.write('Total Stock:' )
file.write('Commission:')
file.write('Total amount:' )
file.write('Net worth in Year(s:')
file.close()

myreceipt=f.readline()

A=float(Rfile.readline())
B=float(Rfile.readline())
C=float(Rfile.readline())
D=float(Rfile.readline())
E=float(Rfile.readline())


P=A*B
CT=P*C/ 100
T=CT+P
Y=P*(1+D/100)**10

print('Price paid for the stock alone is', P)
print('The amount of commission is', CT)
print('Total amount paid is', T)
print('After '+ E + ' years, your shares will be worth:', Y)

opt=input('Would you like a receipt? Yes or No?')

if opt=='Yes':
  file=open('receipt.txt','w')

else:
   print("Have a nice day")
</code></pre>
