Say Hello to Python

As I mentioned partly in my last post, I am trying my skills working from a few months in new environment totally different then used to…

Python differs significantly from the Visual Basic or C++ language, although it also provides many opportunities to process input data and generate results in line with our expectations. Python’s strong value is its extensive number of libraries, with which we can implement solutions in the field of statistics, data analysis and artificial intelligence.

Today I will present first examples of code for beginners. As usual you have a choice with which intepreter you would like to work with, even in notepad. I have installed Python 3.6 and write my programs in PyCharm.

If you decided to work in PyCharm, first open might need a few minutes more for self-configure environment and its components. Before dev. editor installation check if you alredy have Python on you application list:

If so, go to PyCharm (IDE) and select New Project

In our Project path we need to insert python file

First of all, in opossite to Visual Basic, there’s no need to declare data type for our variables, however we can change it and modify whenever we need to. Let’s write few simple lines of code.

Name = "John"
Surname = "Smith"
Age = 35
Sex = "Man"

to check the result we will use a print declaration. Let’s write some simple math operations for our variables:

print(Name + " " + Surname, Age, Sex)

As you can see there’s two methodes: we might declare a variable to introduce mathematical operations or we might just use a print before the argument. Now I will add three lines to check type of my variables:

print(type(Name))
print(type(Age))

To see first results let’s click on the Run

We can click on Debug before Run, to check for errors
#indexing

A = Name + Surname
print (A)
print(A[0:2])
print(A[3:6])
print(A[:-6])
print(A[:6])
print(A[:-6])
print(A[2:-6])

OK, this is where we end the first lesson. Try by yourself.