Option 1 -> "A penny for your thoughts" is used to ask someone what they're thinking, not related to perseverance through difficulties.
Option 2 -> "Hit the nail on the head" means to be exactly right about something, doesn't express hope or optimism.
Option 3 -> "Every cloud has a silver lining" means there's something positive in every difficult situation, expressing hope and optimism.
Option 4 -> "Burn the midnight oil" means to work late into the night, doesn't convey belief in positive outcomes.
Hence, Option 3: every cloud has a silver lining -> This idiom perfectly captures the belief that even in difficult circumstances, there's always hope or something positive to be found, which explains why she never gave up -> correct