Get started learning Python with DataCamp's free Intro to Python tutorial. Learn Data Science by completing interactive coding challenges and watching videos by expert instructors. Start Now!
Ready to take the test? Head onto LearnX and get your Python Certification!
This site is generously supported by DataCamp. DataCamp offers online interactive Python Tutorials for Data Science. Join 575,000 other learners and get started learning Python for data science today!
Welcome
Welcome to the LearnPython.org interactive Python tutorial.
Whether you are an experienced programmer or not, this website is intended for everyone who wishes to learn the Python programming language.
You are welcome to join our group on Facebook for questions, discussions and updates.
After you complete the tutorials, you can get certified at LearnX and add your certification to your LinkedIn profile.
Just click on the chapter you wish to begin from, and follow the instructions. Good luck!
Learn the Basics
- Hello, World!
- Variables and Types
- Lists
- Basic Operators
- String Formatting
- Basic String Operations
- Conditions
- Loops
- Functions
- Classes and Objects
- Dictionaries
- Modules and Packages
Data Science Tutorials
Advanced Tutorials
- Generators
- List Comprehensions
- Lambda functions
- Multiple Function Arguments
- Regular Expressions
- Exception Handling
- Sets
- Serialization
- Partial functions
- Code Introspection
- Closures
- Decorators
- Map, Filter, Reduce
Hello, World!
Python is a very simple language, and has a very straightforward syntax. It encourages programmers to program without boilerplate (prepared) code. The simplest directive in Python is the "print" directive - it simply prints out a line (and also includes a newline, unlike in C).
There are two major Python versions, Python 2 and Python 3. Python 2 and 3 are quite different. This tutorial uses Python 3, because it more semantically correct and supports newer features.
For example, one difference between Python 2 and 3 is the print
statement. In Python 2, the "print" statement is not a function, and therefore it is invoked without parentheses. However, in Python 3, it is a function, and must be invoked with parentheses.
To print a string in Python 3, just write:
Indentation
Python uses indentation for blocks, instead of curly braces. Both tabs and spaces are supported, but the standard indentation requires standard Python code to use four spaces. For example:
Exercise
Use the "print" function to print the line "Hello, World!".
This site is generously supported by DataCamp. DataCamp offers online interactive Python Tutorials for Data Science. Join over a million other learners and get started learning Python for data science today!
0 Comments