Question
using python Function name: bee_script Parameters: file_name (str), output_file (str) Return Type: list You discover that a popular movie on Netflix is the Bee Movie.
using python
Function name: bee_script
Parameters: file_name (str), output_file (str)
Return Type: list
You discover that a popular movie on Netflix is the Bee Movie. You decide to create a function that takes in file_name and writes to a new CSV file created by the output_file parameter. Parameters file_name and output_file will NOT include the file extensions.
The CSV file will contain the following information:
Column 1 line (int)
The corresponding line number of the script (starting at 1)
Column 2 num_words (int)
The number of words the current script line contains
Column 3 contains_bee (str)
YES if the word bee is present in the current script line, else NO. Case sensitivity does NOT matter
Column 4 script_line (str)
The current script line WITHOUT the trailing newline character
Return a list of dictionaries containing the information you wrote into the CSV file. This is what your returned list should look like...
>>> bee_script('bee_movie','bee_stats') [ {'line': 1, 'num_words': 18, 'contains_bee': YES, 'script_line': 'According to all known laws of aviation, there is no way a bee should be able to fly.'}, {'line': 2, 'num_words': 14, 'contains_bee': NO, 'script_line': 'Its wings are too small to get its fat little body off the ground.'}, ..., ]
f{file_name}.csv looks like
line, num_words, contains_bee, script_line 1,18 , YES,"According to all known laws of aviation, there is no way a bee should be able to fly." 2,14 , NO, Its wings are too small to get its fat little body off the ground. 3,15, YES, "The bee, of course, flies anyway because bees don't care what humans think is impossible." 4,8,NO, "Yellow, black. Yellow, black. Yellow, black. Yellow, black." line, num_words, contains_bee, script_line 1,18 , YES,"According to all known laws of aviation, there is no way a bee should be able to fly." 2,14 , NO, Its wings are too small to get its fat little body off the ground. 3,15, YES, "The bee, of course, flies anyway because bees don't care what humans think is impossible." 4,8,NO, "Yellow, black. Yellow, black. Yellow, black. Yellow, blackStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started