Open source
Anyone can use it, study how it works, and contribute.
What Python is and your first program
First program
Change the message, then run it. Python executes here in your browser.
print("Hello, World!")Output
Your program's output will appear here.
NameError: name 'mark' is not defined
NameError: A name was used before Python could find a variable or function with that name.
IndexError: list index out of range
IndexError: The requested position is outside the items in this list or sequence.
KeyError: 'email'
KeyError: That key does not exist in this dictionary.
TypeError: can only concatenate str (not "int") to str
TypeError: This operation does not work with the kind of value it received.
ZeroDivisionError: division by zero
ZeroDivisionError: A number cannot be divided by zero.
SyntaxError: invalid syntax
SyntaxError: Python could not understand the structure of this line. Check spelling, brackets, colons, and quotes.
IndentationError: expected an indented block
IndentationError: The spaces at the start of a line do not match Python's block structure.
Python is a high-level, interpreted programming language. Its interpreter reads and runs your instructions, so you can test a small change without a separate compile step.
Anyone can use it, study how it works, and contribute.
The Python interpreter runs your instructions as a program.
Indentation and plain words make code easier to follow.
Ready-made tools support science, web apps, and automation.
Created by Guido van Rossum, Python was first released in 1991. Today it is used for scripting, data analysis, education, and many other kinds of software.
Program structure
A Python program is a sequence of statements. A statement can call a function such as print(). A colon introduces a block, and indentation shows which statements belong inside it.
student = "Mira"
if student == "Mira":
print("Welcome, Mira!")The indented line belongs to the if statement. Keep indentation consistent.
Keywords have a reserved meaning in Python. An identifier is a name you choose for a variable, function, or class.
“student_name” can be used as an identifier.
FalseNoneTrueandasassertasyncawaitbreakclasscontinuedefdelelifelseexceptfinallyforfromglobalifimportinislambdanonlocalnotorpassraisereturntrywhilewithyieldmatchcase