You can have a data object returned with waitKeyDown that will contain the key that was pressed and the time it occurred. You can then do your if statement based on that keypress data.
Code:
import viz
viz.go()
import viztask
def MyTask():
d = viz.Data()
while True:
yield viztask.waitKeyDown(['y','n'],d)
print 'Key '+d.key+' was pressed'
viztask.schedule( MyTask() )