teach-ict.com logo

THE education site for computer science and ICT

1. Introduction

Any time that a program asks the user for information, there is a chance that the user will input something unexpected. Well written, robust programs should be able to deal with the input data, checking that the inputs match expectations and rejecting those which do not.

This is called data validation, and we will go over some of the basic checks that you are expected to be able to reproduce in your own programs.

Besides data validation, another useful tool in preventing misuse of programs is to limit access to legitimate users. This can be done by user authentication. Even a simple username/password system is good enough for most cases, and we will describe how to include one in Python.