You can use open statement as iterator in for. I do not want to give ready code. I did the code though. Try to read some code snippet code for inspiration. How have you studied and what kind of code have you written until now?

Are you retyping the code hand? Code has basic syntactic errors like 4 and 5 should be after lines 6 and 7 to make the indention right and you are also missing closing " in line 11? I gave you little bad variable name also as sum is built in function. This seemed to work:

Here is some style sample of my own way of doing this without csv and writing some things differently to show alternative ways of writing things in Python:

year = raw_input("enter year you wish to check: ")
revenue_sum = 0.0
## using normal open and filtering the lines in iterator
for year,a,b,amount in (value.split('|') for value in open('revenue.csv') if value.startswith(year+'|')):
revenue_sum += float(amount) ## last column by name from for
## year with 4 numbers, but it is in string format already, so string format, and money with $ and two decimals
print("Sum for %4s = $%.2f" % (year, revenue_sum))
""" Input:2009, Output:
Sum for 2009 = $984.93
"""

This code is format enforcing version, if there is bad line in input with wrong number of items, it will complain with error message. However it does not care if other than requested year's lines have bad format.