vtcbca / internal-exam-23bca316

23bca-python-sqlite-internal-exam-303-PYTHON-EXAM created by GitHub Classroom
0 stars 0 forks source link

q.9 #2

Open 23bca316 opened 1 month ago

23bca316 commented 1 month ago
  1. Create text file on python by taking input from user. Read Python.txt file and Print it in Reverse. internal.txt

explain this program and solve error

23bca260 commented 1 month ago

f=open("python.txt","w") line=[] while True: l=input() if l: line.append(l+"\n") else: break text="\n".join(line) f.write(text) 136 f.close() f=open("python.txt","r") file_content=f.read() f.close() reversed_content=file_content[::-1] print(reversed_content)

I hope your program is successfully run .