English

File = open('textfile.txt','w') word = '' while word.upper() != 'END': word = raw_input('Enter a word use END to quit') file.write(word + '\n') file.close() The above program is to create

Advertisements
Advertisements

Question

file = open('textfile.txt','w')
word = ''
while word.upper() != 'END':
     word = raw_input('Enter a word use END to quit')
     file.write(word + '\n')
file.close()

The above program is to create a file storing a list of words. What is the name of file on hard disk containing list of words?

Very Short Answer
Advertisements

Solution

The file is named textfile.txt, as specified in the open() statement.

shaalaa.com
  Is there an error in this question or solution?
Chapter 7: Data File Handling - EXERCISE [Page 145]

APPEARS IN

CBSE Computer Science with Python [English] Class 12
Chapter 7 Data File Handling
EXERCISE | Q 1. | Page 145
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×