The problem is that 'QgsVectorLayer' objects has no attribute 'renderer'. This kind of method is for raster layers. If you want to change the transparency of QgsVectorLayer objects you have to use the method: 'setLayerTransparency(int)'; located in QgsVectorLayer class.
Next code works for these kind of objects:
mc=iface.mapCanvas()
layers=[]
n = mc.layerCount()
for i in range(n):
layers.append(mc.layer(i))
for layer in layers:
layer.setLayerTransparency(90)
layer.triggerRepaint()
I tested it in QGIS. See next image:
You can modify the above code for including QgsRasterLayer objects too.