Preface

The book introduces readers to writing programming code at a beginner's level (basic coding skills), working the development environment (IDE), using variables and data, operators and expressions, working with the console (reading input data and printing output), usage of conditional statements (if, if-else, if-elif-else), loops (for, while) and working with functions (declaring and calling functions, passing parameters, and returning values). The book uses Python programming language and PyCharm development environment. The covered training material provides basic preparation for a deeper study of programming.

This book only gives you the first steps to programming. It covers very basic skills that you must develop for years, to reach a high enough level and start working as a programmer.

The book is also used as an unofficial textbook for school-level programming courses in the high schools, studying professions like "Programmer", "Application Programmer" and "System Programmer".

Who is This Book Intended for?

This book is suitable for complete beginners in programming, who want to try what programming is and learn the main constructions for writing programming code that is used in software development, regardless of programming languages and technologies used. The book provides a solid basis of practical skills that are used for further study in programming and software development.

Why Did We Choose The Python Language?

For this book, we chose Python, because it is a modern language for high-level programming and at the same time it is easy to learn and suitable for beginners. As a use Python is widespread, with a well-developed ecosystem, numerous libraries, and technological frameworks, and therefore gives many prospects for development. Python combines the paradigms of procedural, functional, and object-oriented programming in a modern way with easy-to-use syntax. In the book, we'll use the Python language and the PyCharm development environment, which is available for free from JetBrains.

As we will explain later, the programming language with which we start is not essential, but we still need to use some programming language, and in this book, we have chosen Python. The book can also be found mirrored in other programming languages such as C# and JavaScript (see https://csharp-book.softuni.org).

The Book in Other Programming Languages: Java, JavaScript, C#, C++

This programming book for complete beginners is available in several programming languages (or is in the process of being adapted for them):

If you prefer a different language, choose from the list above.

Programming is Learned by a Lot of Writing, Not Reading!

If anyone thinks they're going to read a book and learn to program without writing a code and solve tasks hard, they're delusional. Programming is learned with many, many practices, with writing code every day and solving hundreds, even thousands of tasks, seriously and with perseverance, for years.

You need to solve a lot of problems, to make mistakes, to fix them, search for solutions and information on the Internet, to try, to experiment, to find better solutions, get used to the code, syntax, programming language, development environment, error search and debugging of non-working code, task reasoning, algorithmic thinking, breaking down problems in steps and implementing every step, gaining experience and improving your skills every day, because learning to write code is just the first step towards the profession of a software engineer. You have a lot to learn!

We advise the reader, as a minimum, to try all the examples from the book, to interact with them, to change and test them. Even more important than the examples are the exercises because they develop the practical skills of a developer.

Solve all the tasks in the book, because programming is learned by practice! The tasks after each topic are carefully selected to cover in-depth the included learning material. The purpose of solving all tasks from all the topics covered is to give complete writing skills to a program code at the beginners level (as is the purpose of this book).

Solve all the exercises in the book. Otherwise, you won't learn anything! Programming is learned by writing a lot of code and solving thousands of problems!

About Software University (SoftUni)

The Software University (SoftUni) is the largest training center for software engineers in South-Eastern Europe. Tens of thousands of students pass through the university every year. SoftUni was founded in 2014 as a continuation of the hard work of Dr. Svetlin Nakov in training skillful software engineering professionals by a practical, contemporary, and high-quality education that combines fundamental knowledge with modern software technologies and a lot of practice.

Judge System for Exercise Verification

The SoftUni Judge system (https://judge.softuni.org) is an automated Internet system for checking the solutions of programming exercises via a series of tests. The submission and verification happen in real-time: you submit the solution, and within seconds you get an answer whether it is correct. Each successfully taken test gives you the points it gains. For a completely correct solution, you get all the points for this problem. For a partially correct solution, you get part of the points for the problem. For a completely wrong solution, you get 0 points.

This how the SoftUni Judge looks like:

All problems from the current book are available for testing in SoftUni judge, and we strongly recommend testing them after you solve them to be sure you don't miss anything and that your solution works correctly according to the problem requirements.

Keep in mind some specifics about SoftUni judge:

  • For each problem, the judge system keeps the best score you had. Therefore, if you upload a solution with the wrong code or a lower score compared to the previous one, the system won't take away your points.
  • The output of your program is compared by the system to a strictly expected result. Every unnecessary symbol, missing comma, or space may lead to 0 points on a particular test. The output that the judge expects is described in the requirements of every problem and nothing else should be added.

Example: If the output requires printing a number (e.g. 25), do not display any descriptive messages such as The result is: 25. Print the output as it is required, i.e., only the number.

The SoftUni judge system is available any time via its website: https://judge.softuni.org.

  • Use of the system is free of charge.

We are convinced that after a few submitted problems, you will like to receive instant feedback for your solutions, and the Judge system will become your favorite assistant in learning programming.

How to Become a Software Developer?

Dear readers, many of you must have the ambition to become programmers, make a living with software development, or work in the IT sector. That is why we have prepared for you a short guide "How to become a programmer" to navigate you on the steps to this much-desired profession.

Becoming a programmer (at the level of starting work in a software company) would take at least 1-2 years of learning and writing code every day, solving several thousand programming tasks, developing several practical projects, and gaining a lot of experience with code writing and software development. It's not possible for a month or two! The profession of software engineering requires a large amount of knowledge, backed by extensive practice.

There are 4 main skill groups that all programmers must have. Most of these skills are preserved over time and are not significantly affected by the development of specific technologies (which change constantly). These are the skills that every good programmer has and which every rookie should aspire to obtain:

  • code writing (20%)
  • algorithmic thinking (30%)
  • fundamental knowledge of the profession (25%)
  • languages and development technologies (25%)

Skill # 1 - Coding (20%)

Learning how to write code forms about 20% of the minimum skills required for a programmer to start work in a software company. The ability to code includes the following components:

  • work with variables, conditionals, loops
  • functions, methods, classes, and objects
  • work with data: arrays, hash tables, strings

The ability to code can be learned in a few months of intensive studying and solving practical tasks by writing code every day. This book covers only the first part of the coding skill: working with variables, conditionals, and loops. The rest remains to be learned in subsequent trainings, courses, and books.

The book give only the beginning of a long-term and serious study, on the path to professional programming. You won't be able to become a programmer without mastering the material from this book. You will lack programming fundamentals and it will become increasingly difficult to move forward. Therefore pay enough attention to the basics of programming: solve problems and write a lot of code for months until you learn to easily solve all the problems in this book. Then move on.

We pay special attention to the fact that programming language doesn't have significant relevance for one's coding skill. You can either code or not. If you can code in C#, then you'll easily switch to Java or C++, or any other language. These are the skills that each programming book for beginners starts with, including this one.

Skill # 2 - Algorithmic Thinking (30%)

Algorithmic (logical, engineering, mathematical, abstract) thinking forms about 30% of the minimum skills for a start in the profession. Algorithmic thinking is the ability to break a task into a logical sequence of steps (algorithm) and to find a solution for each step, then to put them together in a working solution for the initial task. This is the most important skill that the programmer has.

How to build algorithmic thinking?

  • Algorithms for thinking are developed by reviewing many (1000+) programming tasks, using the most diverse of them. This is the recipe: reducing thousands of practical tasks, inventing an algorithm for them, and executing the algorithm, along with debugging errors along the way.
  • Physics, mathematics, and/or similar sciences help, but they are not restraining! People with engineering and technical inclinations usually learn to think logically easily, because they already have the skills for solving problems, although not algorithmic.
  • The ability to solve programming tasks (which requires algorithmic thinking) is extremely important for programmers. Many companies require only this skill in job interviews.

This book develops a beginner's level of algorithmic thinking, but it is not enough to make a good programmer. To become proficient in the professions, you will need to add logical thinking skills and improve tasks outside this book, such as working with data structures (arrays, lists, matrices, hash tables, tree structures) and basic algorithms (search, sorting, tree structures, recursion, etc.).

As you may guess, the programing language does not matter for the development of algorithmic thinking. To think logically is universal, even if it's not related only to programming. Precisely because of the well-developed logical thinking, it is considered that developers are quite smart and that a simple-minded person could not be a developer.

Skill #3 – Fundamental Knowledge of The Profession (25%)

Fundamental knowledge and skills for programming, software development, software engineering and computer science form about 25% of the developer's minimum start-up skills. Here are the most important parts of these skills and knowledge:

  • basic mathematical concepts related to programming: coordinate systems, vectors and matrices, discrete and indiscreet mathematical functions, end machines and state machines, concepts of combination and statistics, algorithm complexity, mathematical modeling, and others.
  • skills to program - code writing, data work, use of conditional structures and loops, work with arrays, lists and associative arrays, strings, and word processing, working with streams and files, using program interfaces (APIs), working with a debugger, and others.
  • data structures and algorithms - lists, trees, hash tables, columns, search, sorting, recursive, tree crawling, etc.
  • object-oriented programming (OOP) – working with classes, objects, inheritance, polymorphism, abstraction, interfaces, data encapsulation, exception management, design templates.
  • functional programming (FP) - working with lambda functions, high order functions, functions that return a function as a result, closing a state in a function (closure), and more.
  • databases - relational and non-relational databases, database modeling (tables and links between them), SQL query language, object-relational data access (ORM) technologies, transactionality, and transaction management.
  • network programming - network protocols, network communication, TCP/IP, concepts, tools, and technologies from computer networks.
  • client-server interaction, communication between systems, back-end technologies, front-end technologies, MVC architectures.
  • back-end development technologies - web server architecture, HTTP protocol, MVC architecture, REST architecture, web development frameworks, templating engines.
  • web front-end technologies (client development) - HTML, CSS, JS, HTTP, DOM, AJAX, back-end communication, REST API call, front-end frameworks, basic design and UX (user experience) concepts.
  • mobile technologies - mobile applications, Android and iOS development, mobile user interface (UI), server logic call.
  • built-in systems - microcontrollers, digital and analog input and output control, sensor access, peripheral control.
  • operating systems - work with operating systems (Linux, Windows, etc.), installation, configuration and basic system administration, process handling, memory, file system, users, multitasking, virtualization, and containers.
  • parallel programming and asynchronousness - thread management, asynchronous tasks, promises, common resources, and access synchronization.
  • software engineering - source control systems, development management, task planning and management, software development methodologies, software requirements and prototypes, software design, software architectures, software documentation.
  • software testing - unit testing, test-driven development, QA engineering, error reporting and error trackers, test automation, building processes, and continuous integration.

We must make it clear another time that the programming language is irrelevant to the uptake of all these skills. They accumulate slowly, over many years of practice in the profession. Some knowledge is fundamental and can be learned theoretically, but it takes years of practice to fully understand them in depth.

Fundamental knowledge and skills for programming, software development, software engineering, and computer science are taught during the Software Engineering Program, as well as several elective courses. Working with a variety of software libraries, APIs, frameworks, and software technologies and their interaction gradually builds this knowledge and skills, so do not expect that you will understand them from a single course, book or project.

Only initial knowledge in the areas listed above is usually sufficient to start working as a programmer, and acquiring more in-depth knowledge takes place at the workplace according to the technologies and development tools used by the given company and team.

Skill #4 - Programming Languages and Software Technologies (25%)

Programming languages and software development technologies form about 25% of the developer's minimum skills. They are the most voluminous to learn, but they change most quickly over time. If we look at job advertisements from the software industry, there are often all sorts of words mentioned (such as those listed below), but in fact, the ads silently imply the first three skills: to code, to think algorithmically, and to be proficient at the foundation of computer science and software engineering.

For these purely technological skills, the programming language is relevant.

  • Note: only for this 25% of the profession does programming language matter!
  • For the remaining 75% of skills, language does not matter and these skills are time-resilient and transferable between different languages and technologies.

Here are some commonly used software development stacks sought by software companies (up-to-date as of January 2018):

  • JavaScript (JS) + CMO + PH + databases + MongoDB or MySQL + HTTP + web programming + HTML + CSS + DOM + jQuery + Node.js + Express + Angular or React
  • C# + CMO + P + classes from .NET + DATABASE SQL Server + Entity Framework (EF) + ASP.NET MVC + HTTP + HTML + CSS + JS + DOM + jQuéry
  • Java + Java API classes + CMO + AP + databases + MySQL + HTTP + web programming + HTML + CSS + JS + DOM + jQuery + JSP/Servlets + Spring MVC or Java EE / JSF
  • PHP + CMO + databases + MySQL + HTTP + web programming + HTML + CSS + JS + DOM + jQuery + Laravel / Symfony / other MVC framework for PHP
  • Python + CMO + PH + databases + MongoDB or MySQL + HTTP + web programming + HTML + CSS + JS + DOM + jQuery + Django
  • C++ + CMO + STL + Boost + native development + databases + HTTP + other languages
  • Swift + MacOS + iOS + Cocoa + Cocoa Touch + XCode + HTTP + REST + other languages

If the words listed above seem scary and incomprehensible to you, then you are quite at the beginning of your career and have years to learn until you reach the profession of a software engineer. Don't worry, every programmer goes through one or more technological stacks and has to study a set of interconnected technologies, but at the heart of it all is the ability to write programming logic (coding) that develops in this book, and the ability to think algorithmically (to solve programming tasks). You can not do without them!

Programming Language Doesn't Matter!

As already made clear, the difference between programming languages, and more precisely between the skills of programmers in different languages and technologies, is in about 10-20% of skills.

  • All programmers have about 80-90% of the same skills, which do not depend on language! These are the skills to program and develop software, and they are very similar in different programming languages and development technologies.
  • The more languages and technologies you are proficient in, the faster you will learn new languages and the less you will feel a difference between them.

Indeed, the programming language is almost irrelevant, you just need to learn to program, and this starts with coding (this book), continues in the more complex concepts of programming (such as data structures, algorithms, OOP, and FP), and involves the uptake of fundamental knowledge and skills for software development, software engineering, and computer science.

Finally, when you take on specific technologies in a software project, only then will you need a specific programming language, knowledge of specific program libraries (APIs), frameworks, and software technologies (front-end UI technologies, back-end technologies, ORM technologies, etc.). Relax, you will learn them, all programmers learn them, but first, they learn the foundation: to code and to do it well.

This book uses the Python language, but it is not essential and can be replaced by Java, C#, JavaScript, PHP, C++, Ruby, Swift, Go, Kotlin, or any other language. To master the profession of "software developer" it is necessary to learn to code (20%), learn to think algorithmically and solve problems (30%), have a fundamental knowledge of programming and computer science (25%) and know a specific programming language and the technologies relevant to it (25%). Be patient, for a year or two, all this can be achieved at a good starting level, as long as you are serious and diligent.

The Book Which Helps Teachers

If you are a teacher of programming, informatics, or information technology or want to teach programming, this book gives you more than a well-structured learning material with many examples and tasks. Free of charge with the book you receive quality educational content for teaching in school, in the English language, by the school requirements:

  • Educational presentations (PowerPoint slides) for each learning topic tailored to 45-minute hours in schools – free of charge.
  • Well-designed tasks for class and homework, with detailed conditions and sample entrance and exit – free of charge.
  • An automated task and homework verification system (Online Judge System) to be used by students, also free of charge.

The History Behind This Book

The main engine and project manager for the creation of the current free programming book for beginners with open source is Svetlin Nakov, PhD.

In 2014, the SoftUni initiative was launched. In the beginning, it had a wider reach and included more theory, but in 2016 Svetlin Nakov, PhD completely revised them, renovated, simplified, and directed them to be more practical. This is how the learning content core of this book was created.

SoftUni's free programming start-up trainings are probably the largest ever conducted in Bulgaria. On the principle of free software and free knowledge, Svetlin Nakov led a team of volunteers and started this open-source project, initially to create a book based on programming with the C# language and later with other programming languages.

Authors Team

This book is developed by a broad author's team of volunteers who dedicated their time to give away the systematized knowledge and guide you at the start of programming. Below is a list of the main book authors (in alphabetical order):

Boncho Vulkov, Hristo Minkov, Iliya Iliev, Martin Tsarev, Miglen Evlogiev, Milena Angelova, Mirela Damyanova, Nikolay Kostov, Petar Ivanov, Petya Gospodinova, Svetlin Nakov, Tanya Evtimova, Tanya Staneva, Teodor Kurtev, Ventsislav Petrov, Vladimir Damyanovski, Yordan Darakchiev

The book is based on its initial C# variant (Programming Basics with C#), which is developed by a large team of authors that has a significant contribution to the current book. Below is a list of the additional book contributors (editors, translators, others):

Aleksander Krastev, Aleksander Lazarov, Aleksander Peev, Aleksandra Stoycheva, Angel Dimitriev, Ariet Motzeva, Daniel Tsvetkov, Denis Milanov, Dimitar Dzhapunov, Dimitar Tatarski, Dimo Dimov, Diyan Tonchev, Dzhaner Hasan, Elena Rogleva, Hristiyan Hristov, Hristo Hristov, Iskra Nikolova, Ivelin Kirilov, Jordan Liubenov, Julieta Atanasova, Kalin Primov, Kaloyan Nenchev, Kristiyan Pamidov, Luboslav Lubenov, Martin Zhelev, Mihail Georgiev, Natali Dimitrova, Nikola Slavchev, Nikolay Bankin, Nikolay Dimov, Pavlin Petkov, Petar Ivanov, Rositsa Nenova, Ruslan Filipov, Simeon Stavrev, Stefka Vasileva, Svetlin Nakov, Teodor Kurtev, Tonyo Zhelev, Tsvetan Iliev, Vasko Viktorov, Venelin Bekyarov, Ventsislav Petrov, Yanitsa Vuleva, Yulian Linev, Zahariya Pehlivanova, Zhivko Nedyalkov.

Book cover design: Marina Shiderova.

The book is written in the period June-October 2018.

Official Website of The Book

The current book on The basics of Python programming for beginners is available for free use on the Internet from:

https://python-book.softuni.org

This is the official website of the book and there will be uploaded its latest version. The book has been similarly translated to other programming languages listed on its website.

Forum for Your Questions

Ask your questions to this book on Programming Basics in the SoftUni's Reddit Community:

https://www.reddit.com/r/softuni/

In this discussion forum, you will receive a free adequate answer on any questions from the curriculum content of this textbook, as well as on other programming issues. The SoftUni community for those entering programming is so large that usually an answer to a question is received within a few minutes. SoftUni's teachers, assistants, and mentors also answer your questions constantly.

Due to a large number of students learning from this textbook, in the forum, you can find a solution to virtually any task from it, shared by your colleague. Thousands of students before you have already solved the same tasks, so if you're in trouble, look around the forum.

If you still have a specific question, such as why a program doesn't run, that you've been stuck with for a few hours, ask it in the forum and you'll get an answer. You will be surprised how well-intentioned and responsive the users of the SoftUni’s Forum are.

License and Distribution

The book is distributed for free in electronic format under an open license CC-BY-NC-SA.

The source code of the book can be found on GitHub: https://github.com/SoftUni/Programming-Basics-Book-Python-EN.

International Standard Book Number (ISBN): 978-619-00-1403-4.

Bug Reports

If you find bugs, inaccuracies, or defects in the book, you can report them in the official tracker of the project:

https://github.com/SoftUni/Programming-Basics-Book-Python-EN/issues

We can't promise that we will edit everything you send us, but we are willing to constantly improve the quality of this book so that the reported errors and all reasonable suggestions will be addressed.

Enjoy Your Reading!

And be sure to write code in large quantities, try the examples from each topic and, above all, solve the tasks from the exercises. You won't learn to program just by reading, so make sure you put time into solving exercises!

results matching ""

    No results matching ""