8 Answers
New AnswerThe user should be able to enter as many inputs he wants in the function. For eg. An addition function which takes as many inputs the user enters.
1/24/2022 9:07:23 AM
Harsh Sinha8 Answers
New AnswerTry using non keyword arguments. I wrote an example... https://code.sololearn.com/cYbKq8l3c3XQ/?ref=app
Harsh Sinha Use loop to take multiple inputs. There is no any function which will take any number of inputs.
Harsh Sinha The above examples if you provide Hard Code values but if you want to take from user input then you have to use loop like: array = [] while True: number= int(input()) if number == 0: break array.append(number) print (array)
Non keyword arguments are usually used to prevent the program from crashing if we don't know how many arguments will be passed to the function. See the following link for more details and examples. https://code.tutsplus.com/articles/understanding-args-and-kwargs-in-python--cms-29494
Sololearn Inc.
535 Mission Street, Suite 1591Send us a message