When you work with I/O you should be careful and consider the usage of try/exept block since you could get an error when you work with files