The best comparison is:
The electromagnet with 40 coils will be stronger than the electromagnet with 20 coils.
Increasing the number of coils in an electromagnet generally increases its strength, as more wire wraps around the core create a stronger magnetic field when current flows through the coils. However, it may not be exactly twice as strong; the relationship is not strictly linear due to other factors like wire resistance and current limits. But, qualitatively, the electromagnet with more coils will be stronger.