test_keys = ["Rash", "Kil", "Varsha"]
test_values = [1, 4, 5]
# using dictionary comprehension
# to convert lists to dictionary
res = {test_keys[i]: test_values[i] for i in range(len(test_keys))}
# Printing resultant dictionary
print ("Resultant dictionary is : " + str(res))
above, there should be an ending colon " : " after 'for statement' like for i in range(3) :
but this line didn't put " : " at the end of range()
res = {test_keys[i]: test_values[i] for i in range(len(test_keys))}
This is totally out of syntax i knew,
how this is possible?
perhaps is it syntax for dictionary only?