WEBVTT

00:00.000 --> 00:15.000
In this video, we will understand handling non-numeric input using TRI accept, validating user input,

00:15.000 --> 00:19.000
using loops and conditional to ensure valid input.

00:19.000 --> 00:24.000
Ever entered the wrong input and crashed a program, let's fix that.

00:24.000 --> 00:32.000
This student grading system uses exception handling to catch errors, validate input, and keep things running smoothly.

00:32.000 --> 00:35.000
Handling user input

00:35.000 --> 00:41.000
This dictionary stores student names as keys and their corresponding grades as values.

00:41.000 --> 00:47.000
A while loop runs continuously to collect student data until the user chooses to stop.

00:47.000 --> 00:50.000
The program asks for a student's name.

00:50.000 --> 00:54.000
If the user types done, the loop terminates.

00:54.000 --> 01:01.000
If the input is empty, an error message is displayed, and the loop continues.

01:01.000 --> 01:04.000
Catching errors

01:04.000 --> 01:09.000
The program asks users to enter a grade and tries to convert it into a float.

01:09.000 --> 01:14.000
Users try accept to catch non-numeric input errors. It catches value error.

01:14.000 --> 01:22.000
If the grade is not a number and displays an error message instead of crashing the program,

01:22.000 --> 01:25.000
validating inputs

01:25.000 --> 01:34.000
If the grade is outside the valid range, 0 to 100, the program displays an error message and asks for input again.

01:34.000 --> 01:44.000
If the user enters non-numeric input, a plus, or 10, the value error exception is caught, and an error message is displayed.

01:44.000 --> 01:48.000
Storing and displaying data

01:48.000 --> 01:52.000
If the name and grade are valid, they are stored in the dictionary.

01:52.000 --> 02:01.000
Students name equal to grade. After the loop ends, the program displays all stored student records.

02:01.000 --> 02:06.000
With exception handling, our program stays error free and user friendly.

02:06.000 --> 02:12.000
By catching mistakes and validating inputs, we ensure a smooth experience without crashes.

