Write a program to print each line of a file in reverse order

 f=input("enter file name")

file=open(f,'r').read()

l=file.split("\n")

for item in l:

    print(item[::-1])


Comments

Popular posts from this blog

Write a python program to compute cumulative product of a list of numbers (write function cumulative_product).

Write a Python program to compute distance between two points taking input from the user. Formula for Pythagorean theorem for compute distance between two points is: