给定一个数字列表,请编写一个函数,从左往右,遇到是偶数的则一直舍弃;直到遇到奇数,返回余下的所有元素。
【示例】
输入:[2,6,4,10,1,5,4,3]
输出:[1,5,4,3]
解释:列表的前2,6,4,10均为偶数,1为奇数,因此得到余下的[1,5,4,3]
题目难度:简单
题目来源:codewars-The dropWhile Function
def solution(nums: list)-> list:
# your code here
assert solution([2,6,4,10,1,5,4,3]) == [1,5,4,3]
assert solution([1,4,2,3,5,4,5,6,7]) == [1,4,2,3,5,4,5,6,7]
assert solution([2,100,1000,10000,10000,5,3,4,6]) == [5,3,4,6]