Python is a versatile language used in a variety of applications from web development to machine learning. This page will get you up to speed on the basic syntactical elements of the language.
Let's start writing Python by using the simple interpreter. We can print output to the terminal by using the print command. Let's print out the integer 42. Try typing:
Watch videos and take more challenging quizzes below.
Great! Python also uses strings, which are characters wrapped in double quotes. Let's print out your name! Try:
print "[your name]"
Learn more about Python's data types below.
Fantastic! Let's try a more advanced technique called list comprehensions to show how powerful Python can be. Don't worry if you don't understand it, yet! Let's count from 1 to 10! Try typing:
print [x+1 for x in range(10)]
This is a more advanced technique, but you can learn more about for loops below.
Amazing! Another powerful technique is to encapsulate pieces of reusable code into procedures (or functions). We've introduced a function that you can call by running:
Learn more about procedures below.
Final step! Classes are powerful and fundamental concepts to object-oriented programming. They can also contain methods and properties, which can also be procedures!
Run the last command to enter the classroom!
Or, stick around and watch videos about classes below.
A free online book by Zed Shaw. It's written for novice programmers looking to learn Python. It's organized by topic and has very good explanations and example code throughout. Each section ends with helpful 'Study Drills.'
This reference might be overwhelming, but it has links, links and more links on everything Python.
A self-proclaimed opinionated Python best-practices handbook, for both beginners and experts.
Does python documentation overwhelm you? Here's an excellent beginner resource that has clear explanations and simple examples.
A thread on stackoverflow about the most useful modules that come with Python.
Flask is a micro web development framework. It's simple to learn, easy to understand, and well-documented. It's great for small to medium sized projects.
Django is a free and open source high-level web framework for Python that is commonly used in Python applications.
A web-based interactive computational environment that combines code execution, text, mathematics, plots and rich media in a single document.
A tool to help visualize and walk through source code.
A focal point for snippets of Python code that can be used (and reused) for various purposes.
More code examples to perform specific tasks and various snippets for whatever you might need.
This site provides a lot of highly mathematical problems which can be solved with programming. It's a good place for building your 'Procedural Thinking'.
Practice opportunities from the organization that manages the Python language. Some are better than others.
A super-helpful flowchart for when your code isn't working.
A list of different things you might be doing wrong, or things you can probably do better.