Mar-29-2020, 04:51 PM
(Mar-29-2020, 03:32 PM)ndc85430 Wrote: Can you give examples of what you mean please (both input/output and code)? sys.argv
already gives you a list of the arguments, so I don't know what you're splitting.
I have to write a command line argument so the user can write any number of inputs, number can change in every iteration up to user. I mean user can write 1 2 3 4 to the computer in first time she/he running the program but also can write 60 4 5 6 1 9 7 4
in another time.
a, b = input("Enter a two value: ").split()
print("First number is {} and second number is {}".format(a, b))
print()
This is the split example but there is a problem in here which is, the number of inputs are limited by the coder with 2. Which I don't want.
x, y, z = [int(x) for x in input("Enter three value: ").split()]
print("First Number is: ", x)
print("Second Number is: ", y)
print("Third Number is: ", z)
print()
This is an example of the other method an has the same problem, here the number of inputs are limited with 3.