It can help to "storyboard" your program before trying to write it.
For example, consider a program that takes a user entry and converts it first to one thing and then to another. Make a table with three columns on a pad of paper, where the first column is the user entry and the remaining columns are for the two outputs. Fill out the table for a few reasonable inputs; but then add entries for odd inputs (empty string, illegal characters, out of range value, minimum value, maximum value, etc).
I find that visualizing the necessary conversions makes writing the code easier.
This pen-and-paper storyboard (or table) is essentially a statement of the requirements for the program. You can't write a program if you're unsure what it is supposed to do.