Python Training for Beginners

Essentially, what you’re doing is learning how to write code using Python a programming language that’s super popular and easy to use.
Now, the basics. When you open up your text editor or IDE (Integrated Development Environment), you’ll see something like this:

# This is a comment in Python, used to provide information and explanations about the code
print("Hello World!") # This prints "Hello World!" to the console, using the print() function to display the string "Hello World!" on the screen

In this example, we have two lines of code. The first line is a comment it doesn’t do anything but provide some context for what’s going on. The second line uses the `print()` function to output “Hello World!” to your screen. Pretty simple stuff!
Now variables. Variables are like little boxes that you can put things in and then use later on. Here’s an example:

# This assigns a value of 5 to the variable 'x'
x = 5 # This line creates a variable named 'x' and assigns it a value of 5
print(x) # This line uses the print() function to output the value of 'x' to the console, which is 5 in this case. 

# Variables are like little boxes that you can put things in and then use later on. Here's an example:
# This script demonstrates the use of variables by assigning a value to 'x' and then printing it out.

In this code, we create a new variable called `x` and give it a value of 5. We then print out that value using the `print()` function. Pretty straightforward!
Now loops these are like little machines that can repeat certain tasks over and over again until you tell them to stop. Here’s an example:

# This creates a new variable called `x` and assigns it a value of 5
x = 5

# This prints the value of `x` to the console using the `print()` function
print(x)

# This creates a loop that will run 5 times (because we set the variable `i` equal to 0, then increment it by 1 each time)
for i in range(5): # The `range()` function is used here to create a sequence of numbers from 0 to 4 (inclusive)
    print("This will be printed 5 times!") # This prints "This will be printed 5 times!" to the console, but only once per iteration of the loop

In this code, we use a `for` loop to run some code five times. The `range()` function is used here to create a sequence of numbers from 0 to 4 (inclusive), which allows us to iterate over those values using the `for` statement. Pretty cool!
It might seem overwhelming at first, but trust me when I say that once you get the hang of it, programming can be really fun and rewarding.

SICORPS