Ad
Lists
Data Structures
Numbers
Data Types
Functions
Control Flow
Basic Language Features
Fundamentals
Algorithms
Logic

Combination of List

Instructions

Below are Instructions for this Kumite.

Introduction

Given the two list or arrays, filter and combine the numbers into one list or arrays. There will only be numbers in the list.

Requirements

  • There will be no negative number in the list
  • The list must be ordered in ascending order.
  • There must be no repeating number in the list.
  • It must support an empty list.

Test Samples

Below are the test sample for this excercise


# Multiple list should be able to combine into one list
combine_list([1,2,3],[4,5,6])
> [1,2,3,4,5,6]
# Final list should be sorted
combine_list([3,2,1,5],[6,8,7])
> [1,2,3,5,6,7,8]
# There must be no repeating number in the list
combine_list([4,5,6],[7,7,8])
>[4,5,6,7,8]
# The will be no negative number in the list
combine_list([4,5,8],[99,0,11,665,-245])
> [0,4,5,8,11,99,665]
def combine_list(list1,list2):
    return list(set(list(filter(lambda c: (c > 0), list1 + list2))))