+ 3

happy new year to you, hello friends. Help

I have input 5 1 2 3 4 5 How to write such input in Python in an array And the same ones on the list. For example 5 And after it immediately the number 1 2 3 4 5 I am studying python help me.

31st Dec 2020, 5:44 AM
Aid
Aid - avatar
8 Antworten
+ 5
Here are different 5 Methods that outputs 1 2 3 4 5 or [1, 2, 3, 4, 5]. Maybe you can find here what you are referring to. https://code.sololearn.com/ca15A8A19A10
31st Dec 2020, 5:58 AM
noteve
noteve - avatar
+ 3
An example how to handle multiple inputs on the same line. You can use the split() function to convert the input string to a list. The default delimiter is whitespace but you can use another character too. Note you will probably need to convert the values to numeric type with the int() function, if you want to calculate with them. https://code.sololearn.com/cw2ywpU2RF0o/?ref=app
31st Dec 2020, 5:51 AM
Tibor Santa
Tibor Santa - avatar
+ 3
It's a list comprehension.
31st Dec 2020, 6:11 AM
David Ashton
David Ashton - avatar
+ 1
《 Nicko12 》 thanks 😊
31st Dec 2020, 6:00 AM
Aid
Aid - avatar
0
《 Nicko12 》 I mean entering 5 after it in an array 1 2 3 4 5
31st Dec 2020, 5:56 AM
Aid
Aid - avatar
0
《 Nicko12 》 and also, what is the name of this operation [i for i in range(1, num+1)]
31st Dec 2020, 6:03 AM
Aid
Aid - avatar
0
David Ashton thanks 😊, happy holiday.
31st Dec 2020, 6:14 AM
Aid
Aid - avatar
0
n = int(input()) lst = [x for x in range(1,n+1)] print(lst)
1st Jan 2021, 6:38 AM
Yug Kalola
Yug Kalola - avatar