How would this script be implemented without the use of numpy?