Learn Python With Minecraft — Part 2: Syntax and Variables

Carlos Argueta
2 min readFeb 7, 2020

--

“Being able to program a computer is the closest thing to having superpowers.”

Welcome to the second part of my course Learn Python With Minecraft. In Part 1, I introduced the course and guided you through the steps necessary to get our Python x Minecraft environment ready. In Part 2, you will learn to create simple Python programs to teleport the player and post to the Minecraft chat using variables. You will also learn how to identify and fix buggy programs. Let’s go!

First, let’s understand what is a program.

Then, let’s create our very first program and say hello to the Minecraft World.

That first program was rather simple. Let’s get things more interesting by learning about variables.

Variables are cool. Now let’s see how to use them in Python.

Now that you are getting the feel of the Python language, it is time to review its syntax rules.

Let’s use variables to Teleport our player in Minecraft. Let’s begin with Integer variables.

Let’s get more precise by using floating-point variables, or just Floats for short.

Sometimes we need to be able to tell whether something is true or false, or even on or off. There is something for that, it’s called Booleans.

We have grasped the power of Teleportation, now let’s go and tell the world by using Strings to post messages to the Minecraft chat.

Sometimes we need to mix numbers, texts, and other data types together to create powerful interactions. Let’s learn how to convert between data types.

Making mistakes is human, yes even coders make mistakes (regardless of our superpowers). To become a top coder, it is important to recognize and fix buggy programs.

If you made it this far, by watching and following carefully every video above, you are officially a beginner Python programmer. Let’s celebrate by completing together this section’s project.

And that’s it. Let’s quickly review what you have achieved in this course so far.

This article is the second in a series that I will be writing as part of my Learn Python With Minecraft video course. The course will have about 12 parts and each part will be published as it is created. You can see the first part here.

Code for all parts can be found here.

Your feedback is appreciated. If you like the course, please share and clap. Thanks!

--

--

Carlos Argueta

Working on Autonomy for Mobile Robots with an emphasis on State Estimation and the Perception Stack. I occasionally also work on Natural Language Processing.