Coding is a concept which is used for communicating with computers, which consists of essentially writing code which acts as instructions so computers may perform certain tasks. Just as we can communicate in certain languages as humans, we are able to communicate with computers the same way using programming languages. One of the primary languages in computer coding is python, which is what today's demonstration of my coding project is based on.
Python is one of the world's most popular programming languages, as it is versatile and is used to create a variety of aspects which correlate with real life, including many popular online apps and forms of social media such as Instagram, Netflix, and Google. With the aid of python as the primary programming language for my project, I have developed it. The final result of this project when displayed is a variety of spaceships floating in a scene, and I have demonstrated all the steps I have taken in order to add my spaceships, as well as position and animate them using the python programming language. This project is a larger one, which consists of multiple files including HTML and CSS files, where other code such as keyframes and CSS are written which I will demonstrate in another STEM blog. However, in this coding blog, the primary concepts which have been covered in my demonstration include how I have specifically used python to incorporate aspects such as functions, strings, variables, and Booleans into my code.
By first calling a built-in function, and adding values in it, I was able to both adjust the size and displayed text in my project, which was added using a string. In order to change the size of my spaceships, as well as establish a position, I then created variables which I named shipSize, top, left, isEngineOn, and nameOfShip, giving all of these variables’ values. shipSize represents the size of my spaceships, top represents how many pixels from the top the spaceship will be positioned at, left represents how many pixels from the left the spaceship will be positioned at, nameOfShip is how you identify that all spaceships will be the same in terms of dimensions (given a string of arc) and finally, isEngineOn represents whether the ship will be animated or not (given a Boolean value of true).
By then creating another function to add spaceships (named addSpaceship), I added more spaceships, changing the values of top and left (to change the positioning of each spaceship), keeping all other variables constant for each spaceship added.
Although at times, this may look daunting, do not get discouraged! This is a very easy concept to learn, and there are a lot of great resources which are very helpful and useful! University of Waterloo has a great free course on python programming, which is very easy to follow along- especially for beginners who are getting into coding for the first time! This helpful resource can be found here.
Per usual, if you have any questions regarding my work, STEM topics in general, or requests for other interesting STEM topics you would like to see next, feel free to contact me at Coding For Young Minds Community Organization!
Arya Peruma is passionate about making STEM education more inclusive for the underrepresented.