Question: How to raise own error when one positional argument is missing?I have this function that inserts a line at a given index called num.python will
How to raise own error when one positional argument is missing?I have this function that inserts a line at a given index called num.python will raise an error if no num is given but I want to raise my own error.How do I do that?This is what I tried.
def insertNum(self, num, line): if num== None: raise Exception("Num not specified.") else: self.list.insert(num, line) return self.list
But it doesn't work pleaseee helpp
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
