Question: Python / Data Programming Description: Problem/Code: Description Workspace Description Write a function longest_line_length that takes a string file_name as an argument and returns the length

Python / Data Programming
Description: Python / Data Programming Description: Problem/Code: Description Workspace Description Write a function
Problem/Code:
longest_line_length that takes a string file_name as an argument and returns the

Description Workspace Description Write a function longest_line_length that takes a string file_name as an argument and returns the length of the longest line in the file. The length of the line is just the number of characters in it (whitespace included). If the file is empty, the function should return None. Consider a file song.txt with the contents: TEXT 1 Row, row, row your boat 2 Gently down the stream 3 Merrily, merrily, merrily, merril 4 Life is but a dream! longest_line_length('song.txt') should return 35 (including whitespace and newline characters). Use the len function to count the numbers of characters in a line including whitespace and newline characters. Description main.py 1 # Define longest_line_length up here! 4 def main(): print(longest_line_length("song.txt')) Longest line Write a function longest_line_length that takes a string file name as an argument and returns the length of the longest line in the file. The length of the line is just the number of characters in it (whitespace included). If the file is empty, the function should return None. Consider a file song.txt with the contents: 8 if __name__ == __main__': main() 9 TEXT 1 Row, row, row your boat 2. Gently down the stream 3Merrily, merrily, merrily, merrily Life is but a dream! longest_line_length(song.txt') should return 35 (including whitespace and newline characters). Use the len function to count the numbers of characters in a line including whitespace and newline characters

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!