Python Forum
How to call/read function for all elements in my list in python
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to call/read function for all elements in my list in python
#1
Hello everybody,

i need help with a code i have written.

i have defined a function to compare two sequences with the def statement. Now i want to read the code of def function for all strings in my list, but i want to compare all strings.

it looks like that:

new_sequ=['XYZ','ZXY'...] example of list

def sequ(s1,s2):

..............
..............
sequ((new_sequ[0]),(new_sequ[1])) --> i call the function for the 0th and 1st of my list.

therefore i want to read the function for all strings in my list. I want to compare 0th with 1st.. 0th with 2nd ..0th with 3th.... and so on .... then 1st with 2nd....1st with 3rd element....and so on. 2nd with 3th ...2nd with 4th element.... like this.

I hope i described it good enough.
Reply


Messages In This Thread
How to call/read function for all elements in my list in python - by johnny_sav1992 - Jul-27-2020, 04:10 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  PyYAML read list of int zisco 2 272 Apr-02-2024, 12:36 PM
Last Post: zisco
  unable to remove all elements from list based on a condition sg_python 3 413 Jan-27-2024, 04:03 PM
Last Post: deanhystad
  How to remove some elements from an array in python? gohanhango 9 1,122 Nov-28-2023, 08:35 AM
Last Post: Gribouillis
Question mypy unable to analyse types of tuple elements in a list comprehension tomciodev 1 460 Oct-17-2023, 09:46 AM
Last Post: tomciodev
  How to read module/class from list of strings? popular_dog 1 467 Oct-04-2023, 03:08 PM
Last Post: deanhystad
  for loops break when I call the list I'm looping through Radical 4 879 Sep-18-2023, 07:52 AM
Last Post: buran
  How do I call sys.argv list inside a function, from the CLI? billykid999 3 787 May-02-2023, 08:40 AM
Last Post: Gribouillis
  Checking if a string contains all or any elements of a list k1llcod3 1 1,081 Jan-29-2023, 04:34 AM
Last Post: deanhystad
  How to change the datatype of list elements? mHosseinDS86 9 1,950 Aug-24-2022, 05:26 PM
Last Post: deanhystad
  read a text file, find all integers, append to list oldtrafford 12 3,493 Aug-11-2022, 08:23 AM
Last Post: Pedroski55

Forum Jump:

User Panel Messages

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