Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to select an item from a list by knowing its position in the list

How to select an item from a list just by knowing what its position is inside the list.
If the list is
[a,b,c,d,e,f,g]
is there a function that operates something like this
theoreticalfunction(list,position in list) and then the output is the item that was in the selected position

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

If you know the index of an element on the list you can use listName[index] to get it’s value.
For example
lst = [a,b,c,d,e]
print(lst[0]) # returns a

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading