I've just started learning Python. The book I'm studying has the code below. I understand the general meaning and the end result but I don't understand where P
came from and what it does. Could you explain it to me, please?
parts = ['43', '44', '45\n']
numbers = [int(P) for P in parts]
John Kugelman
362k69 gold badges552 silver badges596 bronze badges
asked Dec 12, 2019 at 11:34
1
In your case P is just a variable where you use to get each individual part(P) from list of parts.
answered Dec 12, 2019 at 11:36
Ali BeyitAli Beyit
4141 gold badge6 silver badges19 bronze badges
Start asking to get answers
Find the answer to your question by asking.
Ask question
Explore related questions
See similar questions with these tags.