Working with files is very important to create powerful programs. Let’s see how you can do this in Python.
Continue reading “
Pure Python Spell Checking
Pure Python Spell Checking based on Peter Norvig’s blog post on setting up a simple spell checking algorithm.
Writing a serverless Python function
Serverless computing is a cloud-computing execution model in which the cloud provider dynamically manages the allocation of machine resources.
Copying Input to Output with Python
Script to copy standard input to standard output.
Comparison and Boolean Ops in Python
Python comparisons are unusual in that chaining comparisons is allowed, and works reasonably. Chained comparisons translate to a series of anded terms, repeating the middle. For instance, a < b == c <= d is interpreted as a < b and b == c and c <= d. The only other note is that the middle expression (4 in the below example) is evaluated only once. For a constant, this doesn’t matter, but it will make a difference for expressions which have a side-effect. Note that this does not always have the desired effect. For instance, 3 != 2 != 3 is true, which might not be what you wanted.
Python While Loop
With the while loop we can execute a set of statements as long as a condition is true.
Python If Statement
Python is quite unusual in that blocks of statements are defined not with the usual markers, { and }, or begin and end, but by the actual indention of the code itself.
Hello World in Morse code on Raspberry Pi
Somebody posted a tutorial on YouTube showing a LED blinking “hello world” in Morse code using a Raspberry Pi. However, they only show the code executing, not how it was put together. They also don’t show the hardware setup 🙁
Port Scanner in Python
This post will show how you can make a small and easy-to-use port scanner program written in Python. There are many ways of doing this with Python, but we’re going to do it using the built-in module Socket.
Hello World in Python
This is how you would display “Hello World” in Python.
print("Hello, World!")