Python Tutorials – Understanding and Using filter() function

Python filter() Function

The filter() function returns an iterator were the items are filtered through a function to test if the item is accepted or not.

https://www.w3schools.com/python/ref_func_filter.asp

In simple words, the filter() method filters the given iterable with the help of a function that tests each element in the iterable to be true or not.

https://www.programiz.com/python-programming/methods/built-in/filter

Read More

Python Tutorials – Functions – Definitions, Examples, Tips and Tricks

Python Tutorials – Functions – Definitions, Examples, Tips and Tricks

Let’s go ahead and create our get_at_content() function. Before we start typing, we need to figure out what the inputs (the number and types of the function arguments) and outputs (the type of the return value) are going to be. For this function, that seems pretty obvious – the input is going to be a single DNA sequence, and the output is going to be a decimal number. To translate these into Python terms: the function will take a single argument of type string, and will return a value of type number.

Read More

Working with text when using Python – printing message, quotes, using comments, error messages, printing special characters and storing strings in variables

Open the first page of a book about learning Python, and the chances are that the first examples of code you’ll see will involve numbers. There’s a good reason for that: numbers are generally simpler to work with than text – there are not too many things you can do with them (once you’ve got basic arithmetic out of the way) and so they lend…

Read More