Python
Python is a general-purpose programming language designed for readability, flexibility, and fast development. Its wide range of applications, robust community support, and simplicity make it popular among both beginners and experienced programmers.
Python boasts a vast ecosystem of libraries, frameworks, and packages that expand its capabilities for diverse tasks. These domains include, but are not limited to:
- Web development: With tools like Flask and Django, Python powers websites and web applications.
- Automation and scripting: Python automates repetitive tasks, such as renaming files, sending emails, data entry, and more.
- Deep learning and artificial intelligence: Deep learning frameworks like PyTorch and TensorFlow are used to create and train models that learn to identify objects in images, to predict trends, or for building intelligent chatbots.
- Data analysis: Using libraries like pandas, Python helps analyse data to uncover insights.
- Scientific computing: Python was created to support scientific and mathematical computations. With tools like NumPy, you can simulate physical systems, or analyse experimental data.
A Code Example
As an example, let’s use Python’s print
function. It takes an input which is
everything inside its enclosing parentheses (...)
, and prints this out
to the console.
print(input)
: prints the text representation of the input to the console.
Console in programming refers to an interface for interacting with a computer program. E.g., the code cell below.
Generally, it is used to display output of a program. We will use print
throughout this workshop to examine and debug our code.
- Run the following code to print a text with
Hello there!
to the console.
Hover over the code and click the run button.
About This Workshop
This workshop session will mainly focus on the Python language and its built-in features. We will not cover any external modules such as scientific packages and leave it to the future workshops.
You can find more resources on Python from www.python.org.
Exercises
E1: Edit the following code to print a greeting by replacing the
question mark ?
with your name. The code should greet you when you
run it.
Feel free to modify the code. If you make a mistake, just reload the page to reset all code cells on the page.