Data science | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Data science

n, p = [int(x) for x in input().split()] I’m trying to do the first project from the data science course. I do not fully understand it, can someone help me with it?

6th Apr 2021, 5:19 PM
Usman Jega
Usman Jega - avatar
5 Answers
+ 2
[int(x) for x in input().split()] construction create from string example "2 3", list of integer values [2,3] and n, p = [2,3] equal n = 2, p = 3
7th Apr 2021, 8:54 AM
Илья Мирошник
Илья Мирошник - avatar
+ 1
[int(x) for x in input().split()] This generation equal GeneratedList = [] for x in input().split(): GeneratedList.append(int(x))
7th Apr 2021, 8:57 AM
Илья Мирошник
Илья Мирошник - avatar
+ 1
thank you so much😊
7th Apr 2021, 11:12 AM
Usman Jega
Usman Jega - avatar
0
What interesting u?
7th Apr 2021, 7:51 AM
Илья Мирошник
Илья Мирошник - avatar
0
input().split() Its obviously split inputed string in list by spaces(default)
7th Apr 2021, 8:58 AM
Илья Мирошник
Илья Мирошник - avatar