Programming assignment 3 - rankall function