Computer Science, asked by pikuan, 26 days ago


Find the output of the following program
f = open("a.txt", 'w')
line1 = 'In geometry, the notion of line or straight
line was introduced by ancient'
f.write(line1)
line2 = "\n mathematicians to represent straight
objects with negligible width and depth.'
f.write(line)
f.close()
f = open("a.txt", 'rb+')
print(f.tell())
print(f.read(9))
print(f.tello)
print(f.read()
print(f.tello)
f.seek(5,0)
print(f.read(9))
f.seek(2,1)
print(f.read(7))
f.seek(-7, 2)
print(f.read(5))
f.close()​

Answers

Answered by Anonymous
2

f = open("a.txt", 'w')

line1 = 'In geometry, the notion of line or straight

line was introduced by ancient'

f.write(line1)

line2 = "\n mathematicians to represent straight

objects with negligible width and depth.'

f.write(line)

f.close()

f = open("a.txt", 'rb+')

print(f.tell())

print(f.read(9))

print(f.tello)

print(f.read()

print(f.tello)

f.seek(5,0)

print(f.read(9))

f.seek(2,1)

print(f.read(7))

f.seek(-7, 2)

print(f.read(5))

f.close()

Answered by ᏚɑvɑgeᏀurL
10

Answer:

f.write(line1)

line2 = "\n mathematicians to represent straight

objects with negligible width and depth.'

f.write(line)

f.close()

f = open("a.txt", 'rb+')

print(f.tell())

print(f.read(9))

print(f.tello)

print(f.read()

print(f.tello)

f.seek(5,0)

print(f.read(9))

f.seek(2,1)

print(f.read(7))

f.seek(-7, 2)

print(f.read(5))

f.close()

Similar questions