Part3 || Python List

Поділитися
Вставка
  • Опубліковано 16 жов 2024
  • #python #pythoninterviewquestions #datascienceforbeginners #pythonprogramming #pythontutorial #pandas
    Python Pandas List comprehension - This video will help you translating for loops into list comprehension which are faster version of loops. After watching this video, you can write equivalent list comprehension for any loops.

КОМЕНТАРІ • 6

  • @cricketliveasdf
    @cricketliveasdf Рік тому

    Hello do you provide any industry level training for data scientist

    • @dsconcept20
      @dsconcept20  Рік тому

      Thank you for your interest! Yes, it depends on requirements. Contact Us for more details by filling the form - forms.gle/9JMNutd1aLZbBGfV6

  • @akshykumar1118
    @akshykumar1118 2 роки тому

    [op1*op2 if op2%2==0 for op1 in range(4,5) for op2 in range(1,11)]
    pls check and comment if it is right?

    • @dsconcept20
      @dsconcept20  2 роки тому

      First let me know what are you trying to implement, then I can they if this logic is right or not.
      But, guessing you're trying to multiply op1 with op2 when op2 is even numbers like shown in for loop logic; then the equivalent list comprehension is as given below:
      ## for loop
      lst = []
      for op1 in range(4,5):
      for op2 in range(1,11):
      if op2%2==0:
      lst.append(op1*op2)
      print(lst)
      ## list comprehension
      [op1*op2 for op1 in range(4,5) for op2 in range(1,11) if op2%2==0]

  • @cricketliveasdf
    @cricketliveasdf Рік тому

    How to contact you

    • @dsconcept20
      @dsconcept20  Рік тому

      To get in contact - Pls fill in the form forms.gle/9JMNutd1aLZbBGfV6