Category Archives: Python

Announcing General Availability of PyCharm 5 with new Blocking Feature

Announcing General Availability of PyCharm 5 with new Blocking Feature

Hurray, PyCharm 5 just released, the new major version of our intelligent IDE for Python, web and scientific development! It is one of the updates of our desktop products that comprise the brand new JetBrains Toolbox.


PyCharm 5 is available as a full-fledged Professional Edition for Python and Web development, or as a free and open-source Community Edition for pure Python and scientific development.

PyCharm 5 brings an outstanding lineup of new features, including full Python 3.5 support, Docker integration, Thread Concurrency Visualization, code insight for Django ORM methods, Conda integration, and IPython Notebook v4 support, just to name a few.

The highlights of this version include: Continue reading Announcing General Availability of PyCharm 5 with new Blocking Feature

Sets and Frozensets

Introduction

Graphical Depiction of Sets as Circles The philosopher Wittgenstein didn’t like the set theory and complained mathematics is “ridden through and through with the pernicious idioms of set theory,” He dismissed the set theory as “utter nonsense”, as being “laughable” and “wrong”. His criticism appeared years after the death of the German mathematician Georg Cantor, the founder of the set theory.

Cantor defined a set at the beginning of his “Beiträge zur Begründung der transfiniten Mengenlehre”:
“A set is a gathering together into a whole of definite, distinct objects of our perception and of our thought – which are called elements of the set.” Nowadays, we can say in “plain” English: A set is a well defined collection of objects.

The elements or members of a set can be anything: numbers, characters, words, names, letters of the alphabet, even other sets, and so on. Sets are usually denoted with capital letters. This is not the exact mathematical definition, but it is good enough for the following. Continue reading Sets and Frozensets

Dictionaries

Introduction

We have already become acquainted with lists in the previous chapter. In this chapter of our online Python course we will present the dictionaries and the operators and methods on dictionaries. Python programs or scripts without lists and dictionaries are nearly inconceivable. Like lists dictionaries can easily be changed, can be shrunk and grown ad libitum at run time. They shrink and grow without the necessity of making copies. Dictionaries can be contained in lists and vice versa. But what’s the difference between lists and dictionaries? Lists are ordered sets of objects, whereas dictionaries are unordered sets. But the main difference is that items in dictionaries are accessed via keys and not via their position. A dictionary is an associative array (also known as hashes). Any key of the dictionary is associated (or mapped) to a value. The values of a dictionary can be any Python data type. So dictionaries are unordered key-value-pairs.

Dictionary don’t support the sequence operation of the sequence data types like strings, tuples and lists. Dictionaries belong to the built-in mapping type. They are the sole representative of this kind!

At the end of this chapter, we will show how a dictionary can be turned into one list, containing (key,value)-tuples or two lists, i.e. one with the keys and one with the values. This transformation can be done reversely as well. Continue reading Dictionaries

print

Introduction

There are hardly any computer programs and of course hardly any Python programs, which don’t communicate with the outside world. Above a ll a program has to deliver its result in some way. One form of output goes to the standard output by using the print statement in Python. 1

>>> print "Hello User"
Hello User
>>> answer = 42
>>> print "The answer is: " + str(antwort)
The answer is: 42
>>> 

It’s possible to put the arguments inside of parentheses: Continue reading print

Loops

General Structure of a Loop

Flowchart of a loop Many algorithms make it necessary for a programming language to have a construct which makes it possible to carry out a sequence of statements repeatedly. The code within the loop, i.e. the code carried out repeatedly is called the body of the loop.
Python supplies two different kinds of loops: the while loop and the for loop.

Most loops contain a counter or more generally variables, which change their values in the course of calculation. These variables have to be initialized before the loop is is started. The counter or other variables, which can be altered in the body of the loop, are contained in the condition. Before the body of the loop is executed, the condition is evaluated. If it evaluates to True, the body gets executed. After the body is finished, the condition will be evaluated again. The body of the loop will be executed as long as the condition yields True. Continue reading Loops

Conditional Statements

Some decisions are inevitable

inevitable decisions Under certain conditions some decisions are sometimes in normal life inevitable, as we can can see in our photo. It’s the same for every program, which has to solve some useful problem. There is hardly a way to program without having branches in the flow of code.

In programming and scripting languages, conditional statements or conditional constructs are used to perform different computations or actions depending on whether a condition evaluates to true or false. (Please note that true and false are always written as True and False in Python.)

The condition usually uses comparisons and arithmetic expressions with variables. These expressions are evaluated to the Boolean values True or False. The statements for the decision taking are called conditional statements, alternatively they are also known as conditional expressions or conditional constructs.

The if-then construct (sometimes called if-then-else) is common across many programming languages, but the syntax varies from language to language. Continue reading Conditional Statements