Akansha Yadav builds a multiplication table generator that takes two user inputs and uses try-except to catch ValueError when someone enters non-numeric data. The function prints each product in the format "num × i = result" and prevents the program from crashing on bad input.
Chapters
Let's create a multiplication table using basic concepts like loop, function, and exception handling. So for this purpose, I am going to create a function to generate a multiplication table. Here I am creating a function, passing two values, num and range_end, then printing the multiplication table for number up to this range and the colon. Basically, I am going to use a for loop after that so that I can iterate it onto the number range. Here I am multiplying the numbers and printing the result using the print statement, num multiply i. Then in the main program, I am going to print the multiplication table generator, and then I will be calling the function. Before that, I am taking two input: number and range_end function. It means you want multiplication table up to which number. So I'm saying int enter the input, which is going to be the number for which you want the multiplication table, and then up to what number you want it. Then in the exception handling, I am using ValueError. Let's run this. And test it. So here in this, I am getting multiplication table generator as an input, then testing it with the 24 number table, and here we are getting the 24 number table.