0

Create 2 methods named ‘Hello’. In the 1st Hello method, pass only one argument and pass this message: ‘This function is only having 1 argument’. And in the 2nd Hello method, pass two arguments and pass this message: ‘This function is having 2 arguments’. a. Try to call both the methods and analyze the output of both the methods.

I am confuse that its telling to pass a statement and also telling use one and two arguments, So can I do this.

  • My understanding is that Python doesn't support method overloading by default, so this might not be possible. Method overloading is when you have two methods of the same name with different sets argument inputs, which appears to be what is being asked for here. – magmacollaris Dec 19 '22 at 16:47
  • Welcome to stackoverflow. This is not a free tutorial or code writing service. We can help with problems in your code, but we don't do your homework for you. See [ask]. – Robert Dec 19 '22 at 17:33

1 Answers1

0

See here: How do I use method overloading in Python?

It doesnt look like python supports method overloading in the way you expect. You may need to make one method that accepts two arguments and check to see if they are valid, or create two methods with different names.

Pete
  • 55
  • 5