Python

Obtaining the list length

Aug 7,97

Finding the number of the elements in a list is easy – you simple need to call the len() function …

Read More

Sorting lists permanently

Aug 7,97

To sort the list alphabetically and also keep the sorted order of elements, the sort() method is used: last_names = …

Read More

Sorting lists temporarily

Aug 7,97

Consider the following list of surnames: last_names = 'Jones', 'Antunovich', 'Daniels', 'Thomson' Let’s print the list: print(last_names) 'Jones', 'Antunovich', 'Daniels', …

Read More

Check whether a value is in a list

Aug 7,97

You will often want to check if a certain value appears in a list, e.g. during a registration process to …

Read More

Loop through a list

Aug 7,97

Often times you would want to run through all the items in a list and perform the same action on …

Read More

Modify lists

Aug 7,97

Changing the value of a list element in Python is easy: my_numbers0 = 6 print(my_numbers0) The output confirms that the …

Read More
Geek University 2022