Module 1 - Section 0 - Introduction

Site: ΕΛ/ΛΑΚ Moodle
Course: Python Lab
Book: Module 1 - Section 0 - Introduction
Printed by: Guest user
Date: Thursday, 21 November 2024, 6:16 PM

Description

After the completion of the module the students will be able to:
  • describe what is Python language
  • state what is an IDE
  • use the Thonny IDE
  • create and save Python scripts using Thonny
  • use the CLI - Command Line Interface

What is Python

Python is a general-purpose, high-level programming language. It emphasizes code readability, and allows programmers to write applications in fewer lines of code than would be possible in other languages such as C.

    

    

Python is a clear and powerful object-oriented programming language, comparable to Perl, Ruby, Scheme, or Java.

Some of Python's notable features:

  • Uses an elegant syntax, making the programs you write easier to read.
  • Is an easy-to-use language that makes it simple to get your program working. This makes Python ideal for prototype development and other ad-hoc programming tasks, without compromising maintainability.
  • Comes with a large standard library that supports many common programming tasks such as connecting to web servers, searching text with regular expressions, reading and modifying files.
  • Python's interactive mode makes it easy to test short snippets of code. There's also a bundled development environment called IDLE.
  • Is easily extended by adding new modules implemented in a compiled language such as C or C++.
  • Can also be embedded into an application to provide a programmable interface.
  • Runs anywhere, including Mac OS XWindowsLinux, and Unix.

  • Is free software in two senses. It doesn't cost anything to download or use Python, or to include it in your application. Python can also be freely modified and re-distributed, because while the language is copyrighted it's available under an open source license.

Some programming-language features of Python are:

  • A variety of basic data types are available: numbers (floating point, complex, and unlimited-length long integers), strings (both ASCII and Unicode), lists, and dictionaries.
  • Python supports object-oriented programming with classes and multiple inheritance.
  • Code can be grouped into modules and packages.
  • The language supports raising and catching exceptions, resulting in cleaner error handling.
  • Data types are strongly and dynamically typed. Mixing incompatible types (e.g. attempting to add a string and a number) causes an exception to be raised, so errors are caught sooner.
  • Python contains advanced programming features such as generators and list comprehensions.
  • Python's automatic memory management frees you from having to manually allocate and free memory in your code.

What is an IDE (Intergrated Develoment Environment)

All set to play with Python? Python IDE is the first thing you need to get started with python programming. There are many IDEs available out there in the wild and selecting one can be a daunting task.

You can get started with Python programming in a basic text editor like notepad or choose to go ahead with a complete and feature rich Python IDE like PyCharm, Pydev, Emacs or Eric.

Selection of the right editor can greatly influence productivity and effectiveness of Python programming. Professional programmers invest time well in advance and go for the IDE that best meets their requirements.

Which one should you go for? This is something that you have to decide and totally depends on what you like, need, and can afford. You might need to try a few before narrowing down to the final one.

Most of these IDEs are supported on multiple platforms including Windows, Mac and Linux and are available free of cost. 

There are more advanced commercial IDEs available as well that target enterprises and professional developers. For the course we will use Thonny which is a student oriented IDE developed by the University of Tartu in Estonia.

university of tartu logo


thonny



Thonny explained



thonny explained  

CLI - Command Line Interface

A command-line interface or command language interpreter (CLI), also known as command-line user interface, console user interface and character user interface (CUI), is a means of interacting with a computer program where the user (or client) issues commands to the program in the form of successive lines of text (command lines).

thonny cli


In Thonny CLI is in the lower bottom area.

Commands are written after the symbol >>>

Example. Write after the symbol >>> the command  print ("Hello World!")

>>>  print ("Hello World!")