Python Forum
Correct number wrong position func.
Thread Rating:
  • 4 Vote(s) - 2.25 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Correct number wrong position func.
#2
This can be greatly simplified, example:
>>> list1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0] 
>>> list2 = [4, 8, 2, 0, 5]
>>> # same number, wrong postiion
... [b for a, b in zip(list1, list2) if b != a]
[4, 8, 2, 0]
>>> # same number same position
... [b for a, b in zip(list1, list2) if b == a]
[5]
>>>
Reply


Messages In This Thread
Correct number wrong position func. - by albry - Jan-10-2019, 10:01 AM
RE: Correct number wrong position func. - by Larz60+ - Jan-10-2019, 12:25 PM
RE: Correct number wrong position func. - by albry - Jan-11-2019, 10:58 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How can I print from within actor(func) ?? Pedroski55 2 200 May-01-2024, 05:35 AM
Last Post: Pedroski55
  How to output one value per request of the CSV and print it in another func? Student44 3 1,373 Nov-11-2022, 10:45 PM
Last Post: snippsat
  Am I wrong or is Udemy wrong? String Slicing! Mavoz 3 2,628 Nov-05-2022, 11:33 AM
Last Post: Mavoz
  The code I have written removes the desired number of rows, but wrong rows Jdesi1983 0 1,646 Dec-08-2021, 04:42 AM
Last Post: Jdesi1983
  wrong forum, please delete. reposted in correct forum. woodmister 0 1,610 Jan-04-2021, 11:17 PM
Last Post: woodmister
  Func Animation not displaying my live graph jotalo 0 1,589 Nov-13-2020, 10:56 PM
Last Post: jotalo
  Trying to write func("abcd") -> "abbcccdddd" omm 8 4,206 Oct-24-2020, 03:41 AM
Last Post: bowlofred
  How can i judge 1st string position is correct number christing 3 2,453 Oct-30-2019, 03:32 AM
Last Post: newbieAuggie2019
  python gives wrong string length and wrong character thienson30 2 3,044 Oct-15-2019, 08:54 PM
Last Post: Gribouillis
  Number bug, calculation is wrong d3fi 2 2,478 Aug-27-2019, 05:29 AM
Last Post: perfringo

Forum Jump:

User Panel Messages

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