×
Menu
Index

1.1 Introduction to Python

Python is a high level interpreted programming language used for general purpose programming and scripting. The main advantage of using Python over other programming languages is its readability and user friendliness. Python has a syntax that allows programs to be expressed in fewer lines of code than would be possible in many other languages. Python has a large library of open source modules that can be easily imported and used in any project. An experienced programmer in any other language can pick up Python very quickly, however it is also quite straightforward for beginners to learn and use. Note that the VE Python API uses Python 3 not Python 2.
 
Before attempting to use the VE Python API, it is strongly advised that the user becomes familiar with the basics of the Python Programming Language. Specifically the user must be competent in the following areas:
 
·        Variables and Types
o   How to declare variables
o   Types -> int, float, string, bool
·        Lists
o   Accessing values in a list using []
o   Append and Delete values from list
o   Get max min and length of list
·        Basic Operators
o   Arithmetic operators: ‘+’, ‘-‘, ‘*’, ‘/’
o   Comparison operators: ‘==’, ‘!=’, ‘>’, ‘<’ , ‘>=’, ‘<=’
o   Assignment operators: ‘=’, ‘+=’, ‘-=’
o   Bool operators:  ‘and’, ‘or’
o   Using operators with lists
·        String Formatting
o   String substitution
·        Basic String Operation
o   String slicing
o   ‘.split()’, ‘.strip()’, ‘len(), ‘join()’
o   Concatenating strings using + operator
·        Conditionals
o   ‘if’, ‘else’, ‘elif’ statements
o   Using with Bool operators
·        Loops
o   ‘for’ loop
o   ‘while’ loop
o   ‘break’ and ‘continue’ statements
·        Functions
o   Defining a function
o   Calling a function
o   Arguments and Parameters
·        Dictionaries
o   Initialising a dictionary object
o   Adding and removing items from a dictionary
o   Accessing values in a dictionary using a key
o   Iterating over dictionaries using a ‘for’ loop
 
 
·        Modules and Packages
o   Importing built in modules
o   ‘from’, ‘import’, ‘as’ statements
·        List Comprehensions
o   Creating a new list based on an existing list
·        Classes and Objects
o   Defining a class
o   The ‘__init__ ():’method
o   Defining attributes of a class
o   Defining methods of a class
o   Declaring an object