Q. Two identical files (p1.txt and p2.txt) were created by following two codes (carefully go through the two codes given below).
(a)
obj = open("p1.txt", "w")
obj.write("Better than Heaven or Arcadia")
obj.write("I love thee, O my India!")
obj.write("And thy love I shall give")
obj.write("To every brother nation that lives.")
obj.close()
(b)
obj = open("p2.txt","w")
obj.write("Better than Heaven or Arcadia \n")
obj.write("I love thee, O my India!\n")
obj.write("And thy love I shall give\n")
obj.write("To every brother nation that lives.\n")
obj.close()
What would be the output produced if the files are read and printed with following code.
Answer :-
The output produced by code (a) will be:
Better than Heaven or Arcadiar love thee, 0 my IndialAnd thy love
I shall giveTo every brother nation that lives.
The output produced by code (b) will be:
A poem by Paramhansa Yogananda
Better than Heaven or Arcadia
I love thee, O my India!
And thy love I shall give
To every brother nation that lives.
Post a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )