Presentation is loading. Please wait.

Presentation is loading. Please wait.

Validation final steps Stopping gaps being entered in an input.

Similar presentations


Presentation on theme: "Validation final steps Stopping gaps being entered in an input."— Presentation transcript:

1 Validation final steps Stopping gaps being entered in an input

2 Basic validation using len function What this code will do is prevent an end user entering in code that is less than 0

3 Stopping gaps being entered This code replaces a double space with a normal space using.replace Strips specific characters from a string using a replace function (this example uses a space)

4 Code to validate if entered text or a number Looks at the type of data which has been entered using other methods..isalpha() - contains alphabetic character.isdigit() - contains digits 0-9.isnumeric() - contains numbers

5 Validating-no capitals allowed The following code will not let an end user input capital letters as it will keep looping back asking them to input forever loop which exits when an or condition is met. A.lower() method is also used to force input to become lower case

6 Validating making sure end user enters a name of more than 5 characters A len() function used with a forever loop It exits when the string length is >0 Two different messages can be used What this code will do is that it will loop -you must enter a name if you don’t enter a name and the only way you can stop it is by pressing control c to kill the program This code above puts a validation control in that says if the user enters a name less than 5 characters the program will loop message you must enter more than 5 characters


Download ppt "Validation final steps Stopping gaps being entered in an input."

Similar presentations


Ads by Google