Introduction to the Python Language

What is Python?

Python is a programming language published by Guido van Rossum in 1991.  Using Python, we can develop different types of software such as web applications, computer programs, applications involving database operations, computing tools. 

Software developed with Python can run on platforms such as Windows, Mac, Linux, Raspberry Pi. In order for the application written in Python to work on Android, it must be written according to Android, and appropriate modules and frameworks must be used. ( https://code.google.com/archive/p/python-for-android/ ) You can access Google's Python solution for Android from this link.

Python's most important claim is to do more with less code. The language used is English and the syntax is very close to the spoken language, which is a great advantage especially for those who are good at English. Another claim is to run commands by interpreting them and create rapid prototyping.

Python versions : Currently, Python 3 is the latest version released. (Python 3.10.1) The Python 2 version is still widely used, although it hasn't received any updates other than occasional security updates. Python 3 is explained on our site.

We can use the simplest text editors to write Python, as well as more advanced editors.

Some of the Python Spelling Rules (Python Syntax)

Python is very close to English. Command lines end at the end of the line. That is, semicolons, parentheses, etc. are not placed at the end of the line.

Also, the scopes of loops, methods, classes, etc. are set by indenting lines.  Curly brackets are not used.

Indents are therefore extremely important and should not be misused. This will cause an error if we don't indent where it should be indented, or if we do it where it shouldn't.

The # character is used for comment lines. After this character, the rest of the line is not processed.

Python Installation

We can find out if Python is installed on our computer, and if it is, the version is as follows.

On Windows computers, we can enter the command prompt and issue the " python --version " commands.

C:\Users\BTlessons>python --version

We can use the same command by entering the command line on Linux systems and the Terminal on Mac computers.

You can go to its official site to download the latest version of Python. https://www.python.org/

You can easily install it by downloading the latest Python version from the Downloads page here.

After completing the installation, you can start working with Python. We can use different ways to run Python commands by typing. We can explain them as follows.

Python Console Screen

Go to Command Prompt (cmd) from the start menu. Enter "python" here. Then we can run the commands of the python language by typing. This screen is called the console. Commands are executed line by line. We cannot run many rows at once.

We can use it to test single lines of code. Other than that, it is not preferred.

Python Shell Screen

Run the Python IDLE program from the start menu. The Shell screen appears. Here, too, we can run our codes by writing them. Both console and shell screens are suitable for running single lines of code. In other words, as soon as we type a line and enter, that line is executed.

Using Python IDLE Python File

To write and run a large number of command lines in bulk, click the New File option from the File menu on the Shell screen. Commands are written to the newly opened file and saved. Then, by giving the Run Module command from the Run menu, all commands in that file are run on the Shell screen. The extension of the created files is .py.

We can easily store and move our Python (.py) files on the computer. We can easily run it on any device with Python installed.

Using an Editor Program for Python

Apart from the above methods, we can use different programs to write our Python codes. We can choose from many programs such as Pycharm, Visual Studio Code, Notepad. Although it is not necessary to use these editors, it will be beneficial for us in the preparation of advanced programs.

Running Our Python File From Command Prompt

If we want to run a registered python file from Command Prompt:

  • Open Notepad program
  • Add the line print("Hello World!")
  • Issue the File Menu - Save command.
  • Type "Hello.py" into the filename. (Pyhton files have py extension)
  • Choose encoding Utf-8
  • The save location is your D drive.
  • Find Command Prompt from the start menu and run it.
  • Type D: and enter. Thus, we will have switched to the D drive where we saved the file.
  • Type python hello.py and press Enter.

If you did everything right, the new line "Hello World!" You will see it written. 

 

What is python, what is required to use python, what should I do to learn python, how to use python, python lessons and examples, python introduction, python installation, how to use python

EXERCISES

There are no examples related to this subject.



COMMENTS




Read 656 times.

Online Users: 198



how-to-install-and-use-python