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.

You can find out more about Python from www.python.org.

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.

The workshop aims to provide participants with a solid foundation in Python programming and achieve the following:

  • Have Fun Coding: Roll up our sleeves and have fun writing Python code.
  • Understand Core Python Concepts: Learn fundamental programming concepts, such as, variables, data types, etc., and operations on these types which will enable us to write simple Python programs.
  • Explore Functions: Learn to define and use functions to organise our code effectively and learn reusable and modular programs.
  • Master Control Structures: Learn the use of loops and conditionals which will allow us to control the logical flow of our programs.
  • Build Confidence in Programming: Focus on writing and reading the code. We will not install any tools on our laptops and instead use our browsers (e.g., Google Chrome, Edge, Firefox etc.) to experiment with and explore Python.

Another important goal of this workshop is to foster a beginner-friendly community and an environment that encourages curiosity and experimentation, empowering participants to continue exploring Python independently.

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.

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.