228k views
4 votes
What happens if two functions are defined with the same name, even if they are in different arguments within the same .py files?

User TylerSF
by
3.9k points

1 Answer

6 votes

Answer:

Following are the code to this question:

def data(a):#defining method data that accepts parameter

print (a)#print parameter value

def data(b):#defining method data that accepts parameter

print (b)#print parameter value

x=input("enter value: ")#defining variable x that5 input value from user

print(data(x))#call method data

Output:

enter value: hello..

hello..

None

Explanation:

  • As the above code, it is clear defines that python doesn't support the method overloading because More than one method can't be specified in a python class with the same name and python method arguments have no type.
  • The single argument method may be named using an integer, a series, or a double value, that's why we can say that it is not allowed.
User Natie
by
4.1k points