Another way to do ex. 1 using print