DEV Community

Angular Developer
Angular Developer

Posted on

Python Tutorial for Beginners

Probably the largest hurdle when learning any new programming language is simply knowing where to get started. This is why we, Chris and Susan, decided to create this series about Python Tutorial for Beginners!

Even though we won't cover everything there is to know about Python in the course, we want to make sure we give you the foundation on programming in Python, starting from common everyday code and scenarios. At the end of the course, you'll be able to go and learn on your own, for example with docs, tutorials, or books.

Table Content

Introducing Python: Before you get started on your journey towards learning Python, it's important to know why! We'll talk through what Python is, where you'll use it, and how it can help you problem solve.

Getting Started: There's a few items to install to get up and running. Fortunately, you'll only need a couple of items.

Demo: Configuring Visual Studio Code for Python development

Using Print: Displaying information is probably the most core concept of learning any new programming language. In Python that's done by using print

Demo: Hello, World

Comments: Adding documentation to code makes it easier to maintain it later on, and can even help with debugging.

Demo: Comments

String Concepts: Python supports several data types, the most basic of which being strings. See how strings work in Python.

Demo: Strings

Formatting Strings: While concatenating strings works, it doesn't always read well. Python offers the ability to add placeholders for easier dynamic string creation.

Demo: Formatting Strings

Numeric Data Types: Numbers are another core data type, and the most common one you'll use when doing machine learning. As you might expect, Python offers plenty of options for working with numbers.

Demo: Numbers

Date Data Types: As you might expect, you sometimes need to figure out when something will happen. See how Python supports dates

Demo: Dates

Error Handling: Things are going to go wrong with your code. Error handling can allow you to log errors and exit gracefully.

Demo: Error Handling

Conditional Logic: Of course you'll want code which can make decisions. The core of this is the humble if statement.

Demo: Conditional Logic

Handling Multiple Conditions: Python offers a couple of different options for managing multiple conditions.

Demo: Multiple Conditions

Complex Conditions: When combining complex conditions into a single if statement things can behave in an unexpected manner. See how to avoid a potentially confusing bug.

Demo: Complex Conditions

Collections: You'll frequently need to work lists of items (say a shopping cart) or values (say a collection of RGB values from an image). See how you can use lists, arrays and dictionaries in Python.

Demo: Collections

Loops: Performing operations on each item in a collection is possible through a couple different mechanisms - for and while. See when to use each.

Demo: Loops

Introducing Functions: Functions offer you the opportunity to create reusable blocks of code, which allows you to create easier to use and maintain code.

Demo: Functions

Parameterized functions: Parameters allow you to pass values into functions, making them more flexible and reusable.

Demo: Parameterized Functions

Modules and packages: Modules are files with functions and other reusable blocks of code, which allows you to break complex projects into smaller, more manageable chunks. Packages are modules published by other entities which you can incorporate into your projects.

Virtual Environments: Virtual environments allow you to manage the packages you add to your projects, ensuring proper versioning and simplifying management.

Demo: Virtual environments packages

Calling an API: Most every application you'll create will involve making calls to services hosted by other applications. Python allows you to call external APIs by making HTTP or REST calls.

Demo: Calling an API

JavaScript Object Notation (JSON): JavaScript Object Notation (JSON) is the most common data format used for HTTP and REST APIs. Python allows you to consume JSON and treat it like a Python object.

Demo: JSON

And More

Top comments (0)