Using two Arrays of equal length, how can I create a Hash object where the elements from one array (the keys) are linked to the elements of the other (the values).
For example in Java I can use HashMap:
String[] keys= {"apple", "banana", "cherry"};
int[] vals= {1, 2, 3};
HashMap<String, Integer> hash= new HashMap<String, Integer>();
for(int i= 0; i < keys.length; i++){
hash.put(keys[i], vals[i]);
}
How could do this Python?
dict(zip(keys, vals))