Evgenii Legotckoi
Evgenii LegotckoiFeb. 13, 2018, 5:02 p.m.

Python 3 - Tutorial 001. Introduce

Python is a general-purpose interpreted, interactive, object-oriented, and high-level programming language. It was created by Guido van Rossum during 1985- 1990. Like Perl, Python source code is also available under the GNU General Public License (GPL). Python is named after a TV Show called ‘Monty Python’s Flying Circus’ and not after Python-the snake.

Python 3.0 was released in 2008. Although this version is supposed to be backward incompatibles, later on many of its important features have been backported to be compatible with version 2.7.


Audience

This tutorial is designed for software programmers who want to upgrade their Python skills to Python 3. This tutorial can also be used to learn Python programming language from scratch.


Audience

This tutorial is for software developers who want to upgrade their Python skills to Python 3. This tutorial can also be used to learn the Python programming language from scratch.

The necessary conditions

You must have a basic understanding of the terms of computer programming. The basic understanding of any of the programming languages is a plus.

Executing Python programs

The Python program files has the extension py. Programs are run using the Python interpreter.

For example, such a program written in the file main.py

#!/usr/bin/python3

print ("Hello, Python!")

You can run it by running the following command in the console

python3 main.py

The output will be as follows

Hello, Python!

Overview

Python is a high-level, interpretable, interactive and object-oriented scripting language. Python is designed to be readable. He often uses English keywords, while other languages use punctuation. It has fewer syntactic constructions than other languages.

  • Python is interpreted - Python is processed at run-time by the interpreter. You do not need to compile your program before executing it. This is similar to PERL and PHP.
    Python is interactive - you can use Python hints and interact directly with the interpreter to write your own programs.
    Python is object-oriented. Python supports an object-oriented programming style that is encapsulated within objects.
    Python is a language for beginners. Python is an excellent language for novice programmers and supports the development of a wide range of applications from simple text processing to web browsers for games.

History of Python

Python was developed by Guido van Rossum in the late 80s and early nineties at the National Research Institute of Mathematics and Informatics in the Netherlands.

  • Python is derived from many other languages, including ABC, Modula-3, C, C ++, Algol-68, SmallTalk and Unix shell and other scripting languages.
  • Python is protected by copyright. Like Perl, the Python source code is now available under the GNU General Public License (GPL).
  • Python is now supported by the core development team at the institute, although Guido van Rossum still plays a vital role in guiding his progress.
  • Python 1.0 was released in November 1994. In 2000, Python 2.0 was released. Python 2.7.14 is the latest version of Python 2.
  • Meanwhile, Python 3.0 was released in 2008. Python 3 is not compatible with Python 2. Compatibility with Python 3 was to remove duplicate software constructs and modules to "have one, and maybe one, an obvious way to do this." Python 3.6.4 is the latest version of Python 3.

Python Features

Ease of learning - Python has several keywords, a simple structure and a well-defined syntax. This allows the student to quickly pick up the language.

  • Easily readable - the Python code is more clearly defined and visible to the eyes.
  • Easy-to-maintain - Python source code is fairly easy to maintain.
  • Wide standard library - the main part of the Python library is very portable and cross-platform compatible with UNIX, Windows and Macintosh.
  • Interactive mode - Python supports interactive mode, which allows you to interactively test and debug code snippets.
  • Portable - Python can run on a variety of hardware platforms and have the same interface on all platforms.
  • Expandable - you can add low-level modules to the Python interpreter. These modules allow programmers to add or customize their tools to improve efficiency.
  • Databases - Python provides interfaces for all major commercial databases.
  • Programming GUI - Python supports graphical applications that can be created and transferred to many system calls, libraries and Windows systems, such as Windows MFC, Macintosh and X Window Unix systems.
  • Scalability - Python provides better structure and support for larger programs than shells.

In addition to the above functions, Python has a large list of good functions. A, few are listed below -

  • It supports functional and structured programming methods, as well as OOP.
  • It can be used as a scripting language or can be compiled into bytecode to create large applications.
  • It provides very high-level dynamic data types and supports dynamic type checking.
  • It supports automatic garbage collection.
  • It can be easily integrated with C, C ++, COM, ActiveX, CORBA and Java.
We recommend hosting TIMEWEB
We recommend hosting TIMEWEB
Stable hosting, on which the social network EVILEG is located. For projects on Django we recommend VDS hosting.

Do you like it? Share on social networks!

AP
  • Oct. 19, 2018, 3:54 a.m.
Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:06:47) [MSC v.1914 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> #!/usr/bin/python3
>>> print(Hello,Python!)
python3 main.py
SyntaxError: invalid syntax
>>>
=============================== RESTART: Shell ===============================
>>> #!/usr/bin/python3
>>> print("Hello,Python!")
python3 main.py
SyntaxError: invalid syntax
>>> Hello,Python!
SyntaxError: invalid syntax
>>>  помогите плиз почему у меня так пишет,

Evgenii Legotckoi
  • Oct. 19, 2018, 3:59 a.m.

Добрый день!

Вот это линуксовая директива

#!/usr/bin/python3

Указывает, где находится python пакет в системе. А вы видимо под windows разрабатываете.

Попробуйте просто удалить эту строку.


Konstantin Grudnitskiy
  • April 3, 2020, 8:06 a.m.

Я надеюсь вы уже разобрались в чем дело, но если вдруг нет, то проблема состоит в том, что вы пытаетесь запустить программу из интерпретатора питона.

Файл main.py это уже готовая программа которая выводит в терминал (командную строку) текст:

Hello, Python!

Эту (готовую) программу нужно запускать из интерпретатора команд вашей ОС (Windows: cmd, powershell; UNIX: bash, zsh, csh ...) а не из интерпретатора питона.

Текст файла main.py :

#!/usr/bin/python3
print ("Hello, Python!")

Программа для запуска из выполняемой среды ОС (открыть файл main.py в программе python ):

python main.py

если же вы уже запустили интерпретатор python, то вам достаточно просто написать команду:

print('Hello, Python!')

Comments

Only authorized users can post comments.
Please, Log in or Sign up
AD

C ++ - Test 004. Pointers, Arrays and Loops

  • Result:50points,
  • Rating points-4
m

C ++ - Test 004. Pointers, Arrays and Loops

  • Result:80points,
  • Rating points4
m

C ++ - Test 004. Pointers, Arrays and Loops

  • Result:20points,
  • Rating points-10
Last comments
ИМ
Игорь МаксимовNov. 22, 2024, 11:51 a.m.
Django - Tutorial 017. Customize the login page to Django Добрый вечер Евгений! Я сделал себе авторизацию аналогичную вашей, все работает, кроме возврата к предидущей странице. Редеректит всегда на главную, хотя в логах сервера вижу запросы на правильн…
Evgenii Legotckoi
Evgenii LegotckoiOct. 31, 2024, 2:37 p.m.
Django - Lesson 064. How to write a Python Markdown extension Добрый день. Да, можно. Либо через такие же плагины, либо с постобработкой через python библиотеку Beautiful Soup
A
ALO1ZEOct. 19, 2024, 8:19 a.m.
Fb3 file reader on Qt Creator Подскажите как это запустить? Я не шарю в программировании и кодинге. Скачал и установаил Qt, но куча ошибок выдается и не запустить. А очень надо fb3 переконвертировать в html
ИМ
Игорь МаксимовOct. 5, 2024, 7:51 a.m.
Django - Lesson 064. How to write a Python Markdown extension Приветствую Евгений! У меня вопрос. Можно ли вставлять свои классы в разметку редактора markdown? Допустим имея стандартную разметку: <ul> <li></li> <li></l…
d
dblas5July 5, 2024, 11:02 a.m.
QML - Lesson 016. SQLite database and the working with it in QML Qt Здравствуйте, возникает такая проблема (я новичок): ApplicationWindow неизвестный элемент. (М300) для TextField и Button аналогично. Могу предположить, что из-за более новой верси…
Now discuss on the forum
Evgenii Legotckoi
Evgenii LegotckoiJune 24, 2024, 3:11 p.m.
добавить qlineseries в функции Я тут. Работы оень много. Отправил его в бан.
t
tonypeachey1Nov. 15, 2024, 6:04 a.m.
google domain [url=https://google.com/]domain[/url] domain [http://www.example.com link title]
NSProject
NSProjectJune 4, 2022, 3:49 a.m.
Всё ещё разбираюсь с кешем. В следствии прочтения данной статьи. Я принял для себя решение сделать кеширование свойств менеджера модели LikeDislike. И так как установка evileg_core для меня не была возможна, ибо он писался…
9
9AnonimOct. 25, 2024, 9:10 a.m.
Машина тьюринга // Начальное состояние 0 0, ,<,1 // Переход в состояние 1 при пустом символе 0,0,>,0 // Остаемся в состоянии 0, двигаясь вправо при встрече 0 0,1,>…

Follow us in social networks