# ENGG1330-Computer-Programming-I

## Level 1 (25%)
Your program will receive 
  the capacity of the cache, 
  a list of keys and 
  a list of values as the inputs. 

You are then required to combine the keys and values to initialize a cache as a list of key-value pairs as follows and each key-value pair is stored as a sub-list of length 2.
![𝐾1, 𝑉1], [𝐾2, 𝑉2], …	[𝐾𝑛, 𝑉𝑛],, 𝑤ℎ𝑒𝑟𝑒	𝑛	𝑖𝑠	𝑡ℎ𝑒	𝑛𝑢𝑚𝑏𝑒𝑟	𝑜𝑓	𝑑𝑎𝑡𝑎	𝑖𝑡𝑒𝑚𝑠  

## Requirements:

1. Keys must be stored as integers.
1. Values must be stored as strings.
1. If the numbers of keys and values are different, prints "Warning: number of keys and values are not the same" and outputs an empty cache.
1. If the cache capacity is larger than or equal to the number of data items, stores all the data items in the cache. The order of data items stored in the cache must be the same as the order of the input key-value pairs.
1. If the cache capacity is smaller than the number of data items, keeps only those that are near the end of the inputs (right) up to the capacity. For example, if capacity is 3, keys = [1,2,3,4,5] and values = [-1,-2,-3,-4,-5], cache = [[3, '-3'], [4, '-4'], [5, '-5']].

### Inputs:
1. Capacity of the cache � (integer). � = -1 means that the cache has unlimited capacity.
1. A string of integral keys K1, K2, …, KNk separated by "," where �! is number of keys.
1. A string of values V1, V2, …, VNv separated by "," where �" is number of values.

### Outputs:
1. Warning message if `Nk != Nv`.
1. Cache as a list with format ![𝐾1, 𝑉1], [𝐾2, 𝑉2], …	[𝐾𝑛, 𝑉𝑛],. 

### Assumptions:
- 1 ≤ � ≤ 1000 �� � = −1
- 1 ≤ �!, �" ≤ 1000
- Input keys can be converted to integers
- Input keys are unique, no duplicates
- Input values are non-null string

### Hints:

- You can use "A_STRING".split(",") to split a string separated by a comma "," into a
list of strings, e.g., "1,2,3".split(",") à ["1", "2", "3"]
https://docs.python.org/3/library/stdtypes.html#str.split

### Examples:

Case Sample input Sample output

- case 1 
    - input
      ```
      -1
      1,2,3,4,5,6,7,8,9,10
      101,102,103,104,105,106,107,108,109,110
      ```
    - output
      ```
      [[1,'101'],[2,'102'],[3,'103'],[4,'104'],[5,'105'],[6,'106'],[7,'107'],[8,'108'],[9,'109'],[10,'110']]
      ```

- case 2
    - input
      ```
      3
      1,2,3,4,5,6,7,8,9,10
      101,102,103,104,105,106,107,108,109,110
      ```
    - output
      ```
      [[8, '108'], [9, '109'], [10, '110']]
      ```

- case 3 
  - input
      ```
      6
      9,10
      101,102,103,104,105,106,107,108,109,110
      ```
  - output
      ```
      Warning: number of keys and values are not the same
      []
      ```

- case 4
  - input
      ```
      6
      9,10
      109,110
      ```
  - output
      ```
      [[9, '109'], [10, '110']]
      ```
