filmov
tv
Python Validation of Number Inputs - Preventing Python Program Crashes in Number Guessing Game
Показать описание
Subscribe to our Channel to get regular Video Lessons in Python Programming.
Because we are a slow talker, we recommend you use the YouTube "Tools Cog" on the player bar to watch the video at a speed of 1.5x or even 1.75x.
In this Lesson, we create Program Code to check that a User or Player can only enter positive whole number integer values that are also in the correct number range.
We then go back to our Previous "Number Guessing Game" Project and add this same code so that Player's cannot crash the Program by entering text data, or waste Guesses by entering Numbers which are clearly out of range.
Resources Download Link:
You do not have to use PyScripter for our Course. All of the program code will run in Python 3.7 or higher.
So if you want to use other popular Python IDE’s like PyCharm or MU, that will be okay.
In this Python Lesson we will work on learning the following skills:
- Use "While" Loop processing to give Users multiple chances to enter correct data.
- Use "str()" function to convert numerical data into displayable string format.
- Use "int()" function to convert string data into number format so Python can do math.
- Use Boolean True/False Variables to “Red Flag” unacceptable Input Data.
- Check User Input to make sure it is a whole number value (with no decimals).
- Check User Input to make sure it is within the correct range (eg. 1-3 and not 7).
- Check User Input to make sure it is a positive whole number (eg. Not -5, or -10).
- Check User Input to make sure that numbers like 2 are entered as 2 and not “two”.
Input Validation is a critical part of programming in all computer languages.
It is vitally important to study and understand the validation program code, as well as the organisation structure of the program Validation steps.
The learning here will be essential for future Python Programming Lessons we will be progressively adding to our Channel.
Because we are a slow talker, we recommend you use the YouTube "Tools Cog" on the player bar to watch the video at a speed of 1.5x or even 1.75x.
If you are a Teacher watching this video then click the downloads link and get all of the lesson materials for your students.
Give these resources to your students and we think you will find that some of them will "get it" very quickly. The other students need to watch this video which goes through everything in full detail slowly step by step with repetition of examples.
This is a detailed video, if you want to fast track learning, then just Download and quickly work through the PDF of Step by Step Instructions using the Link given further down below.
There is also an Introduction and Overview PDF document giving a set of Learning Objectives for the Lesson included in the Lesson Downloads.
Then for anything you do not fully understand in these two documents, simply use the Timeline Index below to go and watch the relevant section of Video explanation.
If you have the time it will be extremely beneficial to watch the entire video to maximize learning outcomes.
VIDEO TIMELINE INDEX:
(Click on the time number to jump to that section of the video).
00:00 to 04:43 Introduction and Overview
04:43 to 05:53 Overview of the 3 Types of Validation
05:53 to 08:05 Lesson Learning Objectives
08:05 to 15:10 Overview of Validation Program 1
15:10 to 18:19 Using the Agile Methodology
18:19 to 18:55 Overview of Challenge Task 1
18:55 to 19:45 Overview of Challenge Task 2
19:45 to 22:35 Program 1 - Integer Whole Number Validation
22:35 to 28:32 Version 2 - Adding Number Range Validation
28:32 to 34:01 Challenge 1 - Adding Level Validation to Guessing Game
34:01 to 39:58 Challenge 2 - Adding Guess Validation to Guessing Game
39:58 to 41:22 Guess Validation Program Listing
41:22 to 42:39 Preview of Further Validation Lessons
42:39 to 43:10 Our Website Python Programming Course
43:10 to 43:41 Video Wrap Up and Outro
This video will be useful for anyone learning Computing, especially students doing VCE Applied Computing or VCE Software Development or HSC Computing high school courses in Australia, and GCSE in the UK.
Check with your Teacher or Instructor before getting any Downloads from our Website, as they may already have these materials for you.
You can download a hard copy of the Step By Step Instructions Guide, and the Full Program Code at the following link:
Check with your Teacher or Instructor first, as they may already have these Download materials for you.
You can check out our full Python Programming Course at the following link:
We are planning to make a number of Structured Programming Videos that will be a great course for people to learn how to Program in Python.
Like this video if you found it helpful.
Subscribe to our Channel to get notified of our weekly video updates.
Enjoy,
Passy
Because we are a slow talker, we recommend you use the YouTube "Tools Cog" on the player bar to watch the video at a speed of 1.5x or even 1.75x.
In this Lesson, we create Program Code to check that a User or Player can only enter positive whole number integer values that are also in the correct number range.
We then go back to our Previous "Number Guessing Game" Project and add this same code so that Player's cannot crash the Program by entering text data, or waste Guesses by entering Numbers which are clearly out of range.
Resources Download Link:
You do not have to use PyScripter for our Course. All of the program code will run in Python 3.7 or higher.
So if you want to use other popular Python IDE’s like PyCharm or MU, that will be okay.
In this Python Lesson we will work on learning the following skills:
- Use "While" Loop processing to give Users multiple chances to enter correct data.
- Use "str()" function to convert numerical data into displayable string format.
- Use "int()" function to convert string data into number format so Python can do math.
- Use Boolean True/False Variables to “Red Flag” unacceptable Input Data.
- Check User Input to make sure it is a whole number value (with no decimals).
- Check User Input to make sure it is within the correct range (eg. 1-3 and not 7).
- Check User Input to make sure it is a positive whole number (eg. Not -5, or -10).
- Check User Input to make sure that numbers like 2 are entered as 2 and not “two”.
Input Validation is a critical part of programming in all computer languages.
It is vitally important to study and understand the validation program code, as well as the organisation structure of the program Validation steps.
The learning here will be essential for future Python Programming Lessons we will be progressively adding to our Channel.
Because we are a slow talker, we recommend you use the YouTube "Tools Cog" on the player bar to watch the video at a speed of 1.5x or even 1.75x.
If you are a Teacher watching this video then click the downloads link and get all of the lesson materials for your students.
Give these resources to your students and we think you will find that some of them will "get it" very quickly. The other students need to watch this video which goes through everything in full detail slowly step by step with repetition of examples.
This is a detailed video, if you want to fast track learning, then just Download and quickly work through the PDF of Step by Step Instructions using the Link given further down below.
There is also an Introduction and Overview PDF document giving a set of Learning Objectives for the Lesson included in the Lesson Downloads.
Then for anything you do not fully understand in these two documents, simply use the Timeline Index below to go and watch the relevant section of Video explanation.
If you have the time it will be extremely beneficial to watch the entire video to maximize learning outcomes.
VIDEO TIMELINE INDEX:
(Click on the time number to jump to that section of the video).
00:00 to 04:43 Introduction and Overview
04:43 to 05:53 Overview of the 3 Types of Validation
05:53 to 08:05 Lesson Learning Objectives
08:05 to 15:10 Overview of Validation Program 1
15:10 to 18:19 Using the Agile Methodology
18:19 to 18:55 Overview of Challenge Task 1
18:55 to 19:45 Overview of Challenge Task 2
19:45 to 22:35 Program 1 - Integer Whole Number Validation
22:35 to 28:32 Version 2 - Adding Number Range Validation
28:32 to 34:01 Challenge 1 - Adding Level Validation to Guessing Game
34:01 to 39:58 Challenge 2 - Adding Guess Validation to Guessing Game
39:58 to 41:22 Guess Validation Program Listing
41:22 to 42:39 Preview of Further Validation Lessons
42:39 to 43:10 Our Website Python Programming Course
43:10 to 43:41 Video Wrap Up and Outro
This video will be useful for anyone learning Computing, especially students doing VCE Applied Computing or VCE Software Development or HSC Computing high school courses in Australia, and GCSE in the UK.
Check with your Teacher or Instructor before getting any Downloads from our Website, as they may already have these materials for you.
You can download a hard copy of the Step By Step Instructions Guide, and the Full Program Code at the following link:
Check with your Teacher or Instructor first, as they may already have these Download materials for you.
You can check out our full Python Programming Course at the following link:
We are planning to make a number of Structured Programming Videos that will be a great course for people to learn how to Program in Python.
Like this video if you found it helpful.
Subscribe to our Channel to get notified of our weekly video updates.
Enjoy,
Passy