Tutorials on Web Development, Programming, and Web Design

map and filter in Python

In Uncategorized

Example of the map function in Python. It takes a function and a list and apply that function to every item on the list… my_list = [2, 4, 3, 7, 8]map_object = map(lambda x: x*2,...

read more

Tutorial Python Star Operator

In Uncategorized

Python’s star operator is used in many context. The simplest one is the multiplication operator … And the powers operator… It is used for extending lists… And similarly...

read more

Tutorial on Python Dictionary

In Uncategorized

This is a tutorial on Python Dictionary. Here is an example dictionary… example = { "first_name": "Hello", "last_name": "World", "answer": 42} It consists of key value pairs. You can...

read more

Using regular expressions in Python

In Uncategorized

To use regular expressions in Python, import the “re” module and use Python raw string for the regular expression pattern. For example, if you want to find all non-overlapping...

read more

Javascript Class Tutorial Example

In Uncategorized

In this tutorial, we will create a Shape class as an example which has a “sides” property that is initialized by the constructor… We create a new Shape instance and it prints out...

read more

Python Class Tutorial Example

In Uncategorized

In this tutorial, we will create a Shape class as an example which has a “name” property that is initialized by the init() method… class Shape(): def __init__(self, name): ...

read more

Python Decorators that can Take Parameters

In Uncategorized

What if you want the decorator to be able to take an parameter? Let’s create a “num_times” decorator that when applied will run the wrapped function “n” number of...

read more

Python Tutorial Creating a custom decorator

In Uncategorized

In this Python tutorial, we will create a custom decorator named “print_start_time” which will wrap another function called “say_hello”. The say_hello function is simply...

read more

Tutorial using namedtuples in Python

In Uncategorized

Instead of using a tuple, consider using a namedtuple instead, which is more self-documenting. Consider this function apply_color() which accepts a tuple of three values (which should be the red,...

read more

Learn Web Tutorials is hosted by Hostmonster and design based on Wordpress template by Elegant Themes
All contents are opinions and are copyrighted and may contain display ads and ad links for which site may receive revenues from.
See Terms of Use and Privacy Policy.