Complete the given method called solve which takes as parameter a list A.
This list contains the following types of values:
integers (between 1 and 99, both inclusive)
numbers in form of strings (between 1 and 99, both inclusive) eg, '37', '91'
word form of numbers (between 1 and 99, both inclusive) eg, 'twenty', 'seventeen', 'forty-two'.
Note that the words will always be in lower case!
You have to generate a list with all the values in integer form and return it. The list must be in ascending sorted order.
Example
Input:
[1, 3, '4', '1', 'three', 'eleven', 'forty-seven', '3']
Output:
[1, 3, 4, 11, 47]
Code:
def solve(A):
for i in A:
if A[i]==int:
return A[i]
elif A[i]==str:
return int(A[i])
And its not working. ! can anyone help with the code!