Dec 31, 2022

Getting started with Python

 In this lesson, we will learn the basics of Python and how to get started with writing and running Python programs.

First, let's start by learning how to print a message to the console. In Python, we can use the print() function to print a message to the console.

Here is an example of how to use the print() function:

print('Hello, World!')

This will print the message 'Hello, World!' to the console.

Next, let's learn how to store data in variables. In Python, you can use variables to store data and give the data a name. You can use variables to store numbers, strings, and other data types.

Here is an example of how to create a variable and assign it a value:

name = 'John' age = 30

In this example, we have created two variables: name and age. The name variable is a string (a sequence of characters), and the age variable is an integer (a whole number).

You can also use variables in your print() statements to print the value of the variables.

Here is an example of how to use variables in a print() statement:

print('My name is', name, 'and I am', age, 'years old.')

This will print the message 'My name is John and I am 30 years old.' to the console.

That's it for this lesson! In the next lesson, we will learn about the different data types in Python and how to work with them.