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'.
plz Note that the words will always be in lower case!
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 type(A[i])==int:
return A.extend(A[i])
elif type(A[i])==str:
return int(A[i])
we even need to use sets to remove the duplicates And its not working. ! can anyone help with the code!