I have a class like this in python:
class xyz:
def abc():
#Do Something
def add(x,y):
#Add x and y
def sub(x,y):
#Subtract y from x
def mul(x,y):
#multiply x ynd y
Note: Here "add", "sub" and "mul" are nested methods.
- Is it allowed to make a class like this?
If it is allowed, then i want to access the methods "add", "sub" and "mul" by function parameters. for e.g.:
from xyz import xyz def jkl(input): abc.(input) # By doing this it will raise syntax error. This is just for refernece.
so, when i call jkl(add(2,3)) it should add the numbers. Similarly when i call jkl(sub(4,3)) it should subtract the numbers.
Can it be done?