This is the code I wrote
try:
def max_of_n(*args):
max = 1
for x in args:
if x > max:
max = x
return max
print(max_of_n(int(x) for x in input("Enter the numbers whose max you want to find").split(","))
except:
print("You have entered wrong input")
And for above code I am getting below error
Traceback (most recent call last):
File "C:/Users/Akshay/PycharmProjects/CodeClubProjectsAboutMe/Trial.py", line 8, in <module>
max_of_n(int(x) for x in input("Enter numbers").split(","))
File "C:/Users/Akshay/PycharmProjects/CodeClubProjectsAboutMe/Trial.py", line 4, in max_of_n
if x > max:
TypeError: '>' not supported between instances of 'generator' and 'int'
Can you please help me here ? THE MAIN PROBLEM IS HOW PASS COMMA SEPARATED NUMBER INPUTS TO MY FUNCTION ?