Redid ex38.py
Updated 39 and 40