need a python guy to do work quikly
₹100-400 INR / heure
Part – I (4 points)
Write a function find_longest_word(wordList) that takes a list of words and returns the longest word in the list. If there are multiple longest words (i.e., with the same length), then it should return the first one among them (i.e., the one that appears before others in the list).
Write a program that asks the user to enter some words separated by space (all in one line). Your program then should create a list with the words entered (you can use the built-in split method in strings for this) and output the list and the longest word (using the above function).
Sample run:
Enter a few words and I will find the longest:
The quick brown fox jumps over the lazy dog
The list of words entered is:
['The', 'quick', 'brown', 'fox', 'jumps', 'over', 'the', 'lazy', 'dog']
The longest word in the list is:
quick
____________________________________________________________________________________________________
Part – II (6 points)
Implement the following three functions (you should use an appropriate looping construct to compute the averages):
· allNumAvg(numList) : takes a list of numbers and returns the average of all the numbers in the list.
· posNumAvg(numList) : takes a list of numbers and returns the average of all the numbers in the list that are greater than zero.
· nonPosAvg(numList) : takes a list of numbers and returns the average of all the numbers in the list that are less than or equal to zero.
Write a program that asks the user to enter some numbers (positives, negatives and zeros). Your program should NOT ask the user to enter a fixed number of numbers. Also it should NOT ask for the number of numbers the user wants to enter. But rather it should ask the user to enter a few numbers and end with -9999 (a sentinel value). The user can enter the numbers in any order. Your program should NOT ask the user to enter the positive and the negative numbers separately.
Your program then should create a list with the numbers entered (make sure NOT to include the sentinel value (-9999) in this list) and output the list and a dictionary with the following Key-Value pairs (using the input list and the above functions):
· Key = 'AvgPositive' : Value = the average of all the positive numbers
· Key = 'AvgNonPos' : Value = the average of all the non-positive numbers
· Key = 'AvgAllNum' : Value = the average of all the numbers
Sample run:
Enter a number (-9999 to end): 4
Enter a number (-9999 to end): -3
Enter a number (-9999 to end): -15
Enter a number (-9999 to end): 0
Enter a number (-9999 to end): 10
Enter a number (-9999 to end): 22
Enter a number (-9999 to end): -9999
The list of all numbers entered is:
[4, -3, -15, 0, 10, 22]
The dictionary with averages is:
{'AvgPositive': 12.0, 'AvgNonPos': -6.0, 'AvgAllNum': 3.0}
Nº du projet : #7196403