The general concensus is that which ever Beatle sang the lead vocal wrote the song - apart from Ringo.
Songwriting is not an exact science, so it's probable that all the band had input in varying degrees to everything they did, but certainly the styles are distinct between Lennon and McCartney, and the vocal leads do tend to back up the theory that the singer wrote most of the song.
Just something that might make you laugh - it made me laugh anyway. I remember reading that when Paul McCartney first wrote 'A World Without Love', he thought he'd try it out on the rest of the band to see what they thought of it, but after singing only the first line, they all fell about laughing, so the song was shelved for a very long time. The first line? 'Please lock me away'.
When the Beatles recorded Yellow Submarine, there was a game on in London, Liverpool versus .....
So a crowd of scousers were brought into Abbey Road to sin the chorus.
Later, it was discovered that the recording was useless, as it sounded like, "We all live in a yellow sumbarine."