Question: how to write this function?? * Do not call print or input in functions def write_list_to_file(data_to_write, output_file): r (list of str, file open for writing)
how to write this function?? *Do not call print or input in functions

def write_list_to_file(data_to_write, output_file):
r""" (list of str, file open for writing) -> NoneType Write every element of data_to_write to file output_file, one per line. Do not include a new line to the last element. >>> nums_list = ['10', '20', '30'] >>> output_file = open('test.txt', 'w') >>> write_list_to_file(nums_list, output_file) >>> output_file.close() >>> output_file = open('test.txt') >>> output_file.readlines() ['10 ', '20 ', '30'] >>> output_file.close() """
1, 24.7, 18 2 2, 19.1, 23 3 33, 29.8, 23423 4 4, 0, 234 5 100, 9, 45 6 20, 6, 100 7 3, 4, 5 8 10, 20, 30 9)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
