Posts

Showing posts with the label Python

Mathematical Animation Engine

Image
I recently discovered an interesting Python library called Manim . It’s a powerful tool that allows us to create beautiful animations of mathematical concepts and geometric shapes such as polygons, graphs, and functions. What makes Manim even more exciting is that it can be used directly in Jupyter Notebook. This means I can combine code, text, and animation all in one place — perfect for explaining mathematical ideas in a more dynamic and visual way. To try it out, I created a simple example using Manim to illustrate the Fourier Transform , one of my favourite topics from university. With just a few lines of code, Manim can generate smooth, professional-looking animations that show how complex waveforms are built from simple sine components. I’m excited to explore more possibilities with Manim and use it to present other mathematical concepts in a creative and engaging way. 1. Installation !sudo apt update !sudo apt install libcairo2-dev \    texlive texlive-la...

Horse Racing Game by PyGame

Image
My little son inspired me 🤗 to create a Horse Racing game using Pygame, based on his original Scratch game . 🎮🐴  This project is not only a simple game but also serving as a step-by-step tutorial to help kids and beginners transition from Scratch to Python programming. Find the full game and tutorial: https://github.com/tekichan/py_horse_racing Let’s encourage the next generation of coders! 💻✨ 

Monty Hall Problem Simulation

""" This is a simulation of Monty Hall Problem. https://en.wikipedia.org/wiki/Monty_Hall_problem Suppose you're on a game show, and you're given the choice of three doors: Behind one door is a car; behind the others, goats. You pick a door, say No. 1, and the host, who knows what's behind the doors, opens another door, say No. 3, which has a goat. He then says to you, "Do you want to pick door No. 2?" Is it to your advantage to switch your choice? """ import random NUM_DOORS = 3  # three doors in the game MAX_ROUND = 10000  # number of rounds for statistics change_win_count = 0 for _ in range (MAX_ROUND):   # randomly to put a car behind a door   car_door = random. randint (0, NUM_DOORS - 1)   # the player firstly selects a door   player_first_guess = random. randint (0, NUM_DOORS - 1)   # the host opens another door without a car   host_door = random. choice ([       x for x in range (NUM_DOORS) if x != player_first_guess and...

Statistics Tutorial via Python and Jupyter

You know what? The average salary of Data Scientist in London is £74,644 in 2022. I have created a tutorial about Statistics via Python and Jupyter . The tutorial aims at beginners who are interested in Data Scientist career and want to master Statistics and Python, considered as fundamental knowledges of Data Science. URL:  https://github.com/tekichan/statistics-tutorial

Introduction to EduBlocks

Image
我錄製了一段廣東話視頻,介紹如何使用圖像化工具編程Python。該工具簡單易用,適合對編程有興趣的小朋友和初學者。

Craft Minecraft Server for Python Coding

Image
Minecraft is one of the most popular games amongst teenagers. They enjoy building their own worlds with blocks and start adventure there. Interestingly there is a special build for Raspberry Pi called Minecraft Pi Edition. With this edition, you could code in Python to interact with your Minecraft world. Yet this edition requires you a Rasberry Pi. Thanking RaspberryJuice plugin with Spigot Minecraft server, on the other hand, you can code in Python with your typical Minecraft Java edition. You could follow this article to learn how to set them step by step in your computer. In addition, in order to make the whole setup portable, I will also suggest building a Docker image to contain them together. See the detail at  https://github.com/tekichan/minecraft-py-docker

Teach Kids Python

Image
編程於當今教育已經不可或缺,當中Python語言更是炙手可熱。其實互聯網不乏適合大眾的Python教材,可是內容主要是英文,未必適合本地小朋友使用。有見及此,我特別準備簡單的中文Python編程繪圖教材,以供小朋友學習。請各位友好不吝賜教。 https://github.com/tekichan/teach_kids_python

Google Hash Code 2020

Thank Google for organising such an exciting event: Google Hashcode. Our team of 3 members got global ranking 771 (The 3rd in HK). I am happy here to share my code and lesson learnt to my GitHub . These experiences are also applicable for general dev team practices.