Python Forum
[split] question about list comprehension
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[split] question about list comprehension
#10
I understand split nouw but what i can't understand is this part of the code in line 7
“y = [i for i in input “
this part of the code and why this code is there because the program works without this part of the code if we put in line 7 above, for example
y = input('give me a number: ').split(',')
we get the same result. I understand that this is the work of codo o comprehensive list but not understood why it's there"i in i for input " in lijn 7.
Thanks in advance
Reply


Messages In This Thread
RE: [split] question about list comprehension - by Armin - Jan-13-2020, 11:22 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  List Comprehension Issue johnywhy 5 683 Jan-14-2024, 07:58 AM
Last Post: Pedroski55
Question mypy unable to analyse types of tuple elements in a list comprehension tomciodev 1 562 Oct-17-2023, 09:46 AM
Last Post: tomciodev
  Using list comprehension with 'yield' in function tester_V 5 1,398 Apr-02-2023, 06:31 PM
Last Post: tester_V
  [split] why can't i create a list of numbers (ints) with random.randrange() astral_travel 7 1,668 Oct-23-2022, 11:13 PM
Last Post: Pedroski55
  list comprehension 3lnyn0 4 1,529 Jul-12-2022, 09:49 AM
Last Post: DeaD_EyE
  Split string using variable found in a list japo85 2 1,392 Jul-11-2022, 08:52 AM
Last Post: japo85
  [split] [split] New to the forum, how to post a question? karnik 2 1,337 Feb-12-2022, 03:45 PM
Last Post: deanhystad
  List comprehension used differently coder_sw99 3 1,837 Oct-03-2021, 04:12 PM
Last Post: coder_sw99
  How to invoke a function with return statement in list comprehension? maiya 4 3,004 Jul-17-2021, 04:30 PM
Last Post: maiya
  List comprehension and Lambda cametan 2 2,331 Jun-08-2021, 08:29 AM
Last Post: cametan

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020