Unfortunately, for nouns that don’t end in either ‘o’ or ‘a’ we can’t just presume their gender. You have to remember each individual case as there is no rule whatsoever!
For example,
The word ‘calamar’ (squid) is masculine.
The word ‘col’ (cabbage) is feminine.
The word ‘carne’ (meat) is feminine.
The word ‘coche’ (car) in masculine.
You just have to remember each individual word.
This may seem daunting at first but it becomes a lot easier with practice.