Home > other >  Python
Python

Time:10-09

The question is what mean ah

CodePudding user response:

You may need to strengthen to the input () and int () method, the input all your input into a string, you enter into 23 45 "12"
Then you use int, "23 45 12" this string is cannot become a integer,
According to your code, you want to enter an integer array, you can use the following methods:
 inputArr=input (" ") 
Result=[int (n) for n in inputArr. The split ()]

The Result is what you want to input array,

CodePudding user response:

Input to number 3, as the list instead of int

CodePudding user response:

reference 1st floor nangongxiaobai response:
you may need to strengthen to the input () and int () method, the input all your input into a string, you enter into 23 45 "12"
Then you use int, "23 45 12" this string is cannot become a integer,
According to your code, you want to enter an integer array, you can use the following methods:
 inputArr=input (" ") 
Result=[int (n) for n in inputArr. The split ()]

The Result is what you want to input array,

Thank you, I feel like I'm not too familiar for int and input

CodePudding user response:

refer to the second floor Lemon_sai response:
number of 3 input to need as the list instead of int

Thank you, I feel like I'm not too familiar for int and input