Since JAVA has been overtaken by Oracle, it can’t be mistaken to get skilled with the basic concepts of Python. So this is my short Getting Started tutorial with my personal conclusion.
Instead of getting annoyed about the glorification of Python, it would be better to spend some time to have a short look at this programming framework.
In the most cases a language itself is not the crucial point, but it’s what it’s framework is providing for the developer.
So the most popular thing we hear about is the capabiliy that Python is good for…
- Data Science
- Arteficial Intelligence (especially the library Tensor flow)
To install Python, you have to go to https://www.python.org/downloads/ and download and install Python. The website is clearly arranged and you don’t have to spend much time to search for the correct runtime according to your needs.
After you have downloaded Python, a installation wizard guides you through the installation process in two steps. It catches to my eye that there are not so much options to choose except for the folder where you want to install it.
So what do we need now… a development environment? Hmm… well because I have installed a Visual Studio 2013, i want to test the free „Python support for Visual Studio 2013), which can be found for different Visual Studio versions here:
After the installation, there is a new Project Type available, when choosing
Visual Studio 2013 menu: File –> New Project
After that you can immediatly start to code Python and press the Start-Button. Here is the „Hello World!“-Program:
What is a little bit weird is, that it doesn’t seems to matter if you use the following Syntax instead of the function-based print:
# This Python comment is like a UNIX Shellscript comment
print "Hello world!" # Is it possible to append a comment to the end?
# Is this really clean code if it doesn't matter how you write it?
print ("Hello world!")
# How do you write multi line?
print ("Hello "
"world!") # this works without line break
print "Hello "
"world!" #this not
world!""" #this works but shows the line break
# without declarion of a variable
print "Number 1:";
x = input(); # My first Input
print "Number 2:";
y = input("Here you can enter the input prompt:"); # My next Input
The result is:
print "The result is " + str(x + y) # working
# Python is not converting
#automatically like C# when concatenating an Int to a String
print x #works
print y #works
print "A string for x: " + str(x) +"" #working
print "A string for y: " + y +"" #not working
#because he thinks that y is an Integer
In console applications it is possible to work simply with input and print. By experimenting a while you can find out what is working and what is not…
An input like „2“ will be automatically converted as an integer type (when it only contains an integer). It is possible to print the integers using the function (or command) „print“, but it is not possible to print an integer concatenated to a string.
My first conclusion
„Wenn Sie Python sehen wollen, dann gehen sie doch ins Dschungelcamp!“Nico Gerbig in WhatsApp
For non programmers it seems to be really easy to write small console programs, but the language itself allows much syntax variants that i don’t would expect as clear readable code (especially in Python 2.7 what i have been used ).
But as shown in the following Screenshot newer python versions are a little bit more strict concerning procedure-based-programming.
As you can see above, there is a small onboard IDE shipping with python that has a console in which it is possible to execute python code directly. Additionally it allows you to write programs in whole Python files by selecting the „File->New File“ in the menu.
In further steps i want to find out how to point my Visual Studio to the newer Python framework. Python 3.8 is already installed but i do not have the choice to change it in Visual Studio. So i guess there must be a seperate configuration for this.
I am looking forward to evaluate the Tensorflow AI library and what benefit i can get from it.