#4 Python Glossary: Operator

Operators in python is symbol that can perform value or variable. Operator can execute math, logic, assignment, comparison et cetera operation and give result. Without operator, variable only, python is only store value. But, python have operators so it can make calculate and imitate human mind.

There are various operators in python.

  • Arithmetic operator
  • comparison/ relational operator
  • assignment operator
  • logical operator
  • membership operator
  • Identity operator
  • presedence operator

Arithmetic Operator

Arithmetic operator takes two value or variable then performs a calculation on them. The math operation is for example : addition (+), subtraction (-), multiplication (*) , division (/), %modulus , exponentiation(**). There are basic mathematical operations.

>>> #this is addition or plus
>>> 3+5
8
>>> #this is substraction or minus
>>> 10 - 3
7
>>> #this is multiply two operand (value or variable)  either side of the operator
>>> 4 * 5
20
>>> #division divide first operand by second operand
>>> 10 / 2
5
>>> # modulus divides and returns the value of the remainder.
>>> 10%3
1

Comparison/ Relational Operator

Comparison/ relational operators compare the values on two sides of the value or variable. For example, 4 < 2 (output = False). After we write a comparison between value /variable/operand, then Python program in run mode will tell whether an operand is greater than the other, lesser, equal, or a combination of those. Various comparison operators are ( ==, != , <>, >,<=, etc)

>>> #Equal to (==) check whether first operand equal to the second
>>> 5 == 5
True
>>> x = 10
>>> x == 11
False
>>> # Not equal to (!=) will check whether first is not equal to the second
>>> 3 != 1
True
>>> 5 != 5
False

Assignment Operator

Assignment operators in Python assign the value to a variable. Assign variable that already has value to a variable is allowed. But we can not assign a variable that has no value to a variable. There are several assignment operators used in Python (=, +=, – = , *=, /= , etc.)

Logical Operator

Logical operators consist 3 operator: or, and, not. That are used for combined conditional statements are true or false. The ‘and’ operator return to True only if two side are True. The ‘or’ operator return to True if one or two side are True. The ‘not’ for True is False. The ‘not’ for False is True.

Membership Operator

Membership operator check whether some value is membership of lists. There are two membership operator in Python: ‘in’ and ‘not in’

Identity Operator

Identity operator check whether two object is same. There are two identity operator. There are ‘is’ and ‘not is’.

Precedence operator

Precedence operator avoids ambiguity. It determines which operators need to be evaluated first. Precedence operator consists of parenthesis or (). Then multiplication has a higher precedence than addition. 

#3 Python Glossary : Variable

We have not to find meaning every word in python code. Some of them is user-defined name variable. So their word is as the programmer like.

If we write or read python script, variables often appear. A variable is a container that represents data that we know or we decide it later. in algebra, a variable is a symbol for a number we don’t know yet. It is usually a letter like x or y. In Python, the variable is represented numbers, word, and lists that we already assign or we will assign later.

Compare to spreadsheet like excel, python variable is like cell. Cell is empty container that we can decide value later. Python variable is a reserved memory location. Variable is place that we can store values.

Form of variable in python is:

  • user-defined alphabet or word. The programmer defines a variable name, so find reference of the word is not necessary. So, a programmer can define a variable: var1, dido, doli, bubu, this_is_variable, and so on.
  • a variable name has no spaces.
  • start with a letter or underscore. We can not write a variable that starts with numbers. So, this example that is allowed: yoyo1, y4_ya, y1yi, et cetera. This is the example that not allowed: 1ya, 2yoyo et cetera.
  • consist one or more under case letter, underscore and number. We can not put a number in the first alphabet, but we can put it in a second or more position. For example my_variable, energy_var1, and so on.
  • Some of the words are python word that has specifics function. So we can not use 33 python keywords as a variable. They have another use in python. Python 33 keywords is : False. class, finally, is, return, None, continue, for, lambda, try, True, def, from, nonlocal, while, and, del, global, not, with, as, elif, if, or, yield, assert, else, import, pass, break, except, in, raise.
  • we can assign variable by using “=”. For example my_variable = 10
  • a variable is unique. We can not have two variables that have the same name. Python read it as same variable. Python read last statement as a valid value of the variable. You can see the example below.
>>> my_variable = 10
>>> print my_variable
10
>>> my_variable = 11
>>> print my_variable
11
  • A variable can contain number, text (string), or list (set of data).
  • To assign text to a variable, we have to give quotation mark before and after text.
  • We can assign variable with set of data list. For example, we have a variable that has named my_book. It can contain a set of data.
>>> my_book =['python for beginner', 'dive to python', 'business']
>>> my_text_variable = 'it is text'

#2 First Important Lesson for Python Beginners

Sometimes some of the people have to learn Python programming language in a limited time. Usually, it has to learn because the job challenges them to create python programming. So this article talk about how to start learn and practice python. What issue that we need to know first?
The topic is important because we need to make a good job about python at a limited time.

I argue that important point for beginners to know about python is about program installation, workflow, and the glossary.

Install python program and the related program is important to know. So we can run the program and do the jobs. Workflow of programming is also important, so we can finish and give benefit, even if we create a simple program. Python Glossary is also important to know, so we can write and read python language that computer can obey.

Python and IDE Program Installation

First point. To start to learn Python, we need to know how to install python and related program. Different from another program that it is better to select the newest version of the program, python is not like that. That is because python 2x (Python version that begins with 2) sometimes not compatible with python 3x.

If we have a script that is written in Python 2, we cannot run it by python 3. However, if we want to create scripts from scratch, from blank, it is better to choose python 3, because python foundation will develop python 3. Their support for Python 2 will stop at 2020. Related program to write python code is Integrated Development Environment (IDE) for python. IDE is text editor to write python that has featured that support us to write correctly.

I will show you how to install python and IDE python text editor.

Open a browser and go to https://www.python.org/downloads/. Then choose the latest version of python 2x or 3x that suit for your operating system. If your operating system is Microsoft Windows, choose python for windows. https://www.python.org/downloads/windows/ . If your OS is Mac, choose Mac OS, https://www.python.org/downloads/mac-osx/. If your OS is linux, choose https://www.python.org/downloads/source/. Then click Setup.

Python have features: program that run the code and IDE text Editor. If you want to try another alternative of text editor for python programming, it is a list of that.

  • pycharm
  • sublime text 3
  • notepad++

Workflow of Programming

To begin start python programming, we need to know about the workflow of programming. Workflow programming is simple, but if we do not know, we confuse.

Workflow of programming is two steps. First is writing code in text editor IDE. Second, run program in python. Python also have command prompt, it is place to try or learn program. Python command prompt did not save your code, so don’t write your code here. To access IDE, open your chosen IDE program. If you want to run program, usually IDE have feature to run program.

To practice about programming, we can start to create simple program.

Open text editor IDE, like Python IDLE (Python GUI), Sublime Text, Pycharm, Notepad++ .

That is picture of Python IDLE in windows environment. Click IDLE then write as below.

print (‘Hello world’)

Then save code file, with .py extension. Then run the code. To run the code, click run menu on the top, then run module or F5 in windows. then you will see program in run mode.

That is work flow of python programming.

  • Open text editor or IDE (Integrated Development Environment)
  • Write the code
  • save file to be py extension
  • Run code

Python Glossary

If we know about Python Glossary and punctuation, we can read and write more easily. Of course, some code is long and complex, so we sometimes do not understand. But by know Python glossary, we have step forward to read complex code.

Compare to human language as English, Greek language and so on, Python have different language. Human language has words, sentence, and composition. Python has words, sentence and composition, but it is different. Guido von Rossum create Python language, so it can be read by computer and human. Python is language so human can instruct and program a computer.

Program is instruction or set of instruction that computer can understand and run.

Component of instructions are

  • variable
  • operator (conditional, logic, arithmetic),
  • data type,
  • lists,
  • loops.
  • Class

#1 Introduction to Python Programming Language

My article is about Python. Python is programming language. It is one of programming language, beside another programming language, like java, C++ and so on.

Why this topic is important? Because programming language help us to instruct computer. It help us to do our job. Computer can do big and repetitive job in quick times, if we can instruct computer.

Python have several advantage that important to improve our business and our job. What are the benefits of python?

First, I describe that python is easy and powerful. Python can do more than we can think or imagine. It is like magic. Second, python have developer community that share their code and learn each other’s. Finally, Python is free open source.

After reading this article, you’ll able to know possibility of python programming language, so you can imagine customized program that suitable for your jobs.

Powerful and Easy

First, Python is powerful and easy. To understand this point, lets we explore its feature. It is important to know that python can connect to internet. So it can find, get, read information from internet then manage it to be useful program.

It is also connect to GPS, world map, sensor and actuator of internet of things. That is why Google using python for search engine and automatic driver car. Python is also very good for science and statistics. Therefore, if we want to create machine learning and artificial intelligent, python is good option.

Although have powerful functionality, python programming language is easy because python language have less typing than another language. Guido von Rossum create python because he want create programming language that easy to write and read.

The python functionality is growing because its module is growing. This internet connection feature and growing module make python powerful, especially in internet of things, big data, data science, artificial intelligence, deep learning and automation. Therefore, powerful feature of python offer possibility to help your business and job. Usually, today, business needs big data, artificial intelligence to identify opportunity and threat. That is very important for business.

Big Community

Second point is Python have big community and still growing. Community is important because it can help us to learn and develop functionality of python. We can check python community by check Google query of python, learning forum, blog, tutorial, and chat in internet.

There is many blogs, tutorial, and forum that talk about python. Python have official website that provide reference, python.org. We can also can learn python on udacity, facebook, youtube, reddit, twitter. Founding father of python, Guido von Rossum has twitter account. https://twitter.com/gvanrossum . We can also learn python from dataquest.io, codecademy.

Big python community is important factor to learn and create program that help growing our business and jobs in quick manner.

Free

Furthermore, Python program is free of charge. We can check official statement about its license. Based on official python website, python is free for use and distribute. Python is developed under an OSI-approved open source license, making it freely usable and distributable, even for commercial use. Python’s license is administered by the Python Software Foundation.

That is evidence that we can use python for private use and commercial distribution for free. Google and Facebook use this program language for commercial use. Google and Facebook do not pay for python program language. Of course, if Google hire python worker to code in their company, they pay their employee. But, they do not pay for the program language.

That is no hidden fee if we use and create application for commercial business. Of course, this license can help business because it is reduce cost. Easy to write and read the code also can reduce cost, because it reduces time to work.

As a result, powerful functionality, big community support and free of charge can help business to make automation for internal use or commercial use. Ok, follow the python journey in this blog.