Lightcodepedia

Welcome to Python basics

🐍 Python is the most popular and accessible programming language. It is widely used in various fields, including web development, data science, artificial intelligence, scientific computing, and more. Python’s simplicity and readability make it an excellent choice for beginners and experienced developers alike.

See more ressources below.

Hello world

print("Hello world!")  # print function outputs text to the console

You can copy-paste this code in the Python playground below.

Hello world with variable

# comment: this line, starting with `#` is ignored by python, yet useful for documentation
message = "Hello world!"  # variable assignment
print(message)            # print function outputs the value of the variable

You can copy-paste this code in the Python playground below.

Hello world with input, computation and output

"""
This is the official way to write multi-line comments in Python.
"""
name = input("What is your name? ")  # input function gets user input
message = "Hello " + name            # adding 2 strings
print(message)             

You can copy-paste this code in the Python playground below.

Python playground

More resources

🐍 Python official documentation

πŸ““ Python tutorial for beginners

πŸ““ Python exercises

πŸ“‹ Python cheat sheet

🧐 Python examples