File problem 1.
Write a function named stringsToFile() that opens a file for writing and writes a list of strings to the file, with each element of the list written to a line. Hint: use a for loop to iterate over the list of strings and write them to the file.
Input (two parameters):
* filename -- name of file to open for writing * strlist -- a list of string to write to filename
An example of how to call stringToFile() is:
s0 = 'You are old Father William, the young man said,' s1 = 'And your hair has become very white;'
s2 = 'And yet you incessantly stand on your head--'
s3 = 'Do you think, at your age, it is right?'
lst = [s0, s1, s2, s3]
stringsToFile('FatherWilliam.txt', lst)

Hint stringsToFile is not Python standard name (strings_to_file is), instead for loop you can use built in method of file type adn string type. Do not forget that recommended way to deal with files is with with

Remember to uses meaningful variable names and do not use variables just to obfuscate the code like s-variables in your post.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.