Table of contents

Since Python is becoming more and more popular, Java developers should also take a closer look. After we explained the basics of Python such as the direct definition of lists, practical methods with strings and slicing in another article, this one deals with the container data types list, set, dictionary, tuple and in particular the sorting of lists.


More on Python and Java for developers


Michael Inden


Michael Inden is a Java and Python enthusiast with over twenty years of professional experience. He is currently Head of Development, speaks at conferences and writes specialist books on Java and Python at dpunkt.verlag.

For smaller databases, it makes sense to create lists in the form of collection literals as a comma-separated sequence of values ​​surrounded by square brackets. Lists and collection literals can even be added.

>>> numbers = [1, 2, 3]
>>> numbers += [4, 5, 6, 7]
>>> numbers
[1, 2, 3, 4, 5, 6, 7]

The definition works not only for numbers, but also for textual values, a mixture of them and even for nested lists.

comments_outline_white

Read comments (2)

To home page

California18

Welcome to California18, your number one source for Breaking News from the World. We’re dedicated to giving you the very best of News.

Leave a Reply