Define a function named "secondLarge" which take a list of numbers (integer) as parameter.
This function will then identify and return the 2nd largest number in the list. The function will
return smallest number if the parameter only contains two numbers. While the function will
return the only number if the list contain only single number. On some odd case, the function
will return -999 if the parameter contains other datatype i.e. string or floaat in the list.
FOR EXAMPLE:
• [1,2,3,4,5,6] returns 5
• [6,8,3,4,6] returns 6
• [53, 23] return 23
• [13] return 13
• [12, 'not number', 23] return -99220
Define a function named "excludeItem" which take two parameters (item1 & item2) and both
are list. This function will create a separate list named "result" which only include items found
in both lists. The result list should not have duplicate value.
For example, given item1 = [1,2,3,4,2,1] while item2 = [2, 4, 4, 2]. This function will return a
result of [2,4]. Note that the output value is unique (no duplicate). The function must be able
to accept other parameters as well i.e. list of strings or mixture of strings and digits
Define a function named "countCharacter" that accepts a sentence as parameter (string) and
calculate the total number of letters, total number of uppercase letters, total number of
lowercase letters, total number of digits and total number of characters that is not letter and
not digit.
The function will then return a list of integer representing total number of letters , number of
letters with uppercase and lowercase, number of digits and any other character beside letters
and digits.
Suppose the following input is supplied to the function
"Hell0 WorlD!!!4567" the function will return a list with the following values
[9, 3, 6, 5, 4]
Define a function named "calAverage" which take a list of integers as parameter. This function
will then calculate and store the average into a variable named "result". Finally, the function
MUST return the result with 2 decimal place only. For Example given the following list,
[2,6,8,3,4,6], the function will return 4.83 (float).
Create a Python script which will accept a positive integer and will determine the input number if PERFECT, ABUNDANT, DEFICIENT.
PERFECT – if the sum of the divisors of the number except the number itself is
equal to the number.
E.g. 6 = 1, 2, 3, 6 1 + 2+ 3 = 6
ABUNDANT – if the sum of the divisors of the number except the number itself
is greater than the number.
E.g. 12 = 1, 2, 3, 4, 6, 12 1 + 2 + 3 + 4 + 6 = 16
DEFICIENT – if the sum of the divisors of the number except the number itself is
less than the number.
E.g. 10 = 1, 2, 5, 10 1 + 2 + 5 = 8
Sample Output:
Input a Positive Integer : 20
20 is ABUNDANT!
I need the code to have an output stated above.
Create a Python script which will accept a positive integer and will determine the input number if PERFECT, ABUNDANT, DEFICIENT.
PERFECT - if the sum of the divisors of the number except the number itself is equal to the number.
E.g. 6= 1, 2, 3, 6 1+2+3=6
ABUNDANT - if the sum of the divisors of the number except the number itself is greater than the number.
E.g. 12= 1, 2, 3, 4, 6, 12 1+2+3+4+6 = 16
DEFICIENT- if the sum of the divisors of the number except the number itself is less than the number.
E.g. 10= 1, 2, 5, 10 1+2+5=8
Sample Output:
Input a Positive Integer : 20
20 is ABUNDANT!
Create a Python script which will accept two positive integers and will display the COMMON DIVISORS.
Sample Output:
Positive Integer 1 : 20
Positive Integer 2: 12
COMMON DIVISORS of 20 and 12 are...
1 2 4
I need the code to have an output stated above.
Create a Python script which will accept two positive integers and will display the COMMON DIVISORS.
Sample Output:
Positive Integer 1:20 Positive Integer 2: 12
COMMON DIVISORS of 20 and 12 are....
1 2 4
Create a Python script which will accept a positive integer and will display the DIVISORS of the input number.
Sample Output:
Input a Positive Integer: 20
The DIVISORS of 20 are...
1 2 4 5 10 20
Create a Python script which will accept a positive integer (n) and any character then it will display the input character n times.
Sample Output:
Positive Integer (n): 7
Input any Character: A
AAAAAAA