This project will show you how to create your first program using Python, the programming language for beginners.
First of all we need to install the programming software Geany, we are using the Fedora operating system for this tutorial.
In the Gnome system menu, go to Accessories and select Root Terminal.
You may be asked to enter the root password to continue.
We will now use the command terminal to download and then install the Geany programming software.
In the command line type apt-get install python geany xterm and press enter to run the command.
You will be told that the installation will use just over 9MB of storage space and you will be asked if you would like to continue. Press Y and press enter to continue.
The installation of Geany is now complete, you may now close the terminal.
We will now open Geany from the Gnome system menu by going to Programming and then selecting Geany.
Once Geany is open, click on the File menu and navigate to New (with Template) and select main.py this will now open a new Python file for us to create our program with.
When opening a new Python file, Geany automatically inserts unnecessary code.
As only the first line is needed for us to create our first program I usually delete the code so that only the first line remains.
We are going to keep our first program very simple – When the program is run it will display a line of text.
Within the second line of the code type Print.
Notice how the word “Print” will change to purple which demonstrates that Geany has recognised Print as a function.
Insert a space after Print and enter the line of text that you would like to be displayed in the program within brackets.
Now click on the cogs icon to run your first program!
Your first program will now open in a new Window, although it’s only a simple program you should be proud of yourself!
Post a Comment