Question: Write a function extract_num() in python that takes two parameters: a file-name and an integer (x). The function should do the following: 1. Read the
Write a function extract_num() in python that takes two parameters: a file-name and an integer (x). The function should do the following:
1. Read the input file- entirely at once or line by line (use either: readline() or read()).
2. Create a list (lst1) which contains all words (strings) from the file as its elements. (use: split())
3. Create a new list (lst2) which contains all integers from lst1 which are greater than x. (use: int() to convert words that are strings into integers)
4. Find and print the maximum value from lst2 (do not use max() function)
5. Return lst2
(Python)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
