Just like most high-level programming languages, Python also supports the idea of classes. Once the class(es) is/are created they can be inside the main python file or separated (in most usage scenarios), along with it methods. For Python-specific syntax, please refer to its documentation online or offline (python.org is a good start), but you should […]
Category: Education
Fun riddle…let’s solve it together
There are 50 horses and 50 kings riding along an old dirt road. (We still have Kings? WTH?!) They came to a peach tree with 50 peaches (peach tree grows well somewhere I guess!). Each took one, yet there were still 49 left. How is this possible? Well, capitalization may be of importance, or not. […]
How to change keyboard strokes (C/C++) Part 1/2
In the following simple C program, I’ll demonstrate how to capture keystrokes and turn them into something completely different…other than what the key labels read. This is the basic idea behind changing keyboards from English to another language; take the input from the key, read its character code (ordinal value) from the operating system, and […]
Let’s Play Palindrome! (C/C++)
Did you know that the longest Palindromic word in the Oxford English Dictionary is “tattarrattat” coined by James Joyce in Ulysses (1922) meaning “a knock on the door”? What is a Palindrome, you ask? Well, you already know it or have seen it. According to Wikipedia: “A palindrome is a word, phrase, number, or other […]
Let’s Play Palindrome! (Python)
Did you know that the longest Palindromic word in the Oxford English Dictionary is “tattarrattat” coined by James Joyce in Ulysses (1922) meaning “a knock on the door”? What is a Palindrome, you ask? Well, you already know it or have seen it. According to Wikipedia: “A palindrome is a word, phrase, number, or other […]
How Similar are Two Words?
Ever wonder what similarity a pair of words have with each other? Quantifiably? As in percentage? As in 50% match or 100% match, etc.? (Whoa, wouldn’t that be great if that worked out in dating world, eh?). Anyway, it’s okay if you haven’t wondered about it, because I did and here I share a few […]
Letters to Patterns (what does your name look like?)
Letters, in whatever language/scripts are really glyphs aren’t they? They’re a visual representation of a letter that’s supposed to sound (or not sound) like something that we repeated until we memorized it since birth. All good 🙂 I was thinking of different ways to represent letters…you know, just for fun! Yes, I’m weird like that. […]
Fill-up Tanks Quiz (Scratch)
Welcome back! You’ve surely seen images as below that appear online (internet sites, social media apps, etc.) In this Scratch app, I’ll demonstrate how to turn those static quiz images into an interactive, dynamic quiz application. Ouput: This is what a quick game play session looks like in this app. Design: First, I need […]
Adding sound to Python code
Python isn’t necessarily for multimedia programming, so only recently I looked up ways to add audio in a Python script. Turns out there are several ways to do that. They’re all really simple. Methods to add sound: 1. import winsound fname = “soundfile.wav” winsound.PlaySound(fname, winsound.SND_FILENAME) 2. import pygame pygame.init() s = pygame.mixer.Sound(“soundfile.wav”) # Start playback […]
Program to care for a pet (Scratch)
Hello, and welcome back. Today, A fun program to introduce kids/beginners to understand logic and loops while taking care of a pet fish 🙂 Easy to code and easy to play. Code is commented with explanation. Check it out here: https://scratch.mit.edu/projects/282372671/ Enjoy! Challenge: I intentionally kept the core code simple and uncomplicated. However, if you grasp the […]