Python 7.8 : Exercise : Multiplication tables

We will continue with the functions but with an exercise, for this exercise we will create a function, that we will name multiplication table and inside we will implement and code to make the multiplication and on the screen we will return the multiplication table by 5, for example, 1 x 5 = 5, 2 x 5 = 10, 3 x 5 = 15, 4 x 5 = 20, and so on until 10 x 5 = 50 so we are going to name function table multiplication for that we need the min and the max the me must begin by and the max by 10 it is necessary to note that this function takes in parameter n which represents the number of the table of multiplication as ... here we are with the table of multiplication by 5 we could also put 1 x 2 = 2 , 2 x 2 = 4 , so on and so forth so the n will vary according to your requirements and this parameter is mandatory as well as the min and max and in this exercise you must also manage the case of error if for example the min is greater than the max, an error message is returned to the screen so I'll let you do the exercise and we'll meet again in a few minutes for the correction concerning the correction we're going to create def I'm going to copy this and I'll paste parenthesis that takes parameter n colon and inside this function I'm going to put the min equal to 1 the max equal to 10 I implement now by doing for i in range parenthesis min comma max colon and as here we put range min min which starts at 1 is inclusive and max which starts at 10 is exclusive i.e. it will return from one to nine it returns from 1 to 10 , we will do at this level the more I'm going to do print i n equals i times n attention here the X is not the multiplication sign it's rather the star it's good if I throw on my code see that there is nothing simply because we didn't call the function I want to call the table function and I'm going to pass the parameter 5 I'm going to throw again it makes well the table of multiplication until 10 therefore it is okey and now at this level one could pass as parameter the min the max and to remove this is here I will put I raise you can see that it's the same thing, it's the same thing that hasn't changed, here the parameter is not optional and if we want to make it optional I'll put it at this level at 1 and here I'll put it equal to 10 I restarted it is the same thing if I delete for example this that I restart it is always the same thing if I put instead 10 I restart you see that it displays rather 10 times Simply because we have not added the min and to remedy that I can put here max equal and I raise is displayed our code normally because here we have signaled. That that it takes the min puts the value of the max is 10 even if we have passed two parameters. It is good and now we are going to manage the case of error the case of error I am going to make here an if if The min is superior to the max before doing that I'm going to cut this first and I'm going to put for example 11 and I'll have the. you see so we're going to have to manage this case I'll leave the 11 and we'll deal with it here. I'll glue back together what I had cut so if the min is greater than the max two point print error you have to enter enter a number lower than the max and I restart my code you see that the error is displayed and here we can put in simple return as we explained above it's the same thing I'll delete this and I'll put max instead and I'll rerun and our code works normally so that's all for this video and we'll see you next time always on the expertise but with a questioning.