"A good way to keep a job is by having a good attitude" vs. "A good way to keep a job is to have a good attitude"
Which of the two sentences above is correct?
They both work for me. I prefer the second.
Remember - correct capitalisation, punctuation and spacing make posts much easier to read.