<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 <img src="images/JHI_STRAP_Web.png" style="width
Step1:  It is very common to want to combine strings together into longer text, often including numbers or other values. A widely used approach to string formatting is percentage sign place holders
Step2:  <a id="python_lists"></a>
3. Lists
<p></p>
<div class="alert-success">
<b>The Python `list` serves as a general purpose data structure for holding an *ordered* collection of values.</b>
</div>
This is similar to an array in other languages, and is commonly used in conjunction with a for loop as shown later. 
You can have a list of strings, a list of integers, etc. - and you can even mix several types of data in the same list.
The length of a list is defined as the number of elements in the list.
```python
Create a list of strings
names = ["Peter", "Sue", "Leighton"]
print(len(names))
```
```python
Create a list of several data types
things = ["a name", 3.5, names]
print(things)
```
Step3:  <a id="for_loops"></a>
4. for loops
<p></p>
<div class="alert-success">
<b>`for` loops are a very common programmatic way to iterate over a number of items in a sequence (and then do something with each item)</b>
</div>
Most programming languages, including Python, have several ways to repeat a block of code multiple times.
Python's for loop works with a loop variable (letter in the example below) which takes in turn each of the values to be looped over (here the letters in the string variable message)
Step4:  Another common situation is to loop over a list of values
Step5:  Elsewhere in the workshop you'll see this syntax used with other constructs.
<a id="functions"></a>
5. Defining Functions
<p></p>
<div class="alert-success">
<b>Often as your Python code gets longer you will find you repeat snippets of code.
<br></br><br></br>
It is usually best to turn the repeated code into a *function* which can be defined once and then used multiple times.</b>
</div>
This reduces the amount of typing you have to do
It also reduces the opportunity for introducing mistakes through typos and other errors
```python
The Python keyword def is short for 'define'
Here you are defining a function taking one argument
def make_message(name)
Step6:  <p><p><div class="alert-info">
`for` loops are very important for reducing duplicated code so in this example, rather than calling our function three times, we could do this
Step7:  The examples we have shown so far are functions taking a single argument, but they can take multiple arguments. Even optional arguments are possible (not shown here). 
The example below is a function which requires two arguments, and we combine it with a list to make a rudimentary base frequency calculator
Step8:  <p><p><div class="alert-info">
This example also introduced something new for counting the letters in a string. `Python` strings have lots of *methods*, a special kind of `Python` function acting on the the object itself via this `.method(...)` syntax.
</div>
<ASSISTANT_TASK:>
Python Code:
# Assigning a string to a variable
# Concatenating and printing strings
Explanation: <img src="images/JHI_STRAP_Web.png" style="width: 150px; float: right;">
02 - Python Basics (10min)
Table of Contents
Python strings
Python lists
Python for-loops
Python functions
<a id="python_strings"></a>
1. Strings
<p></p>
<div class="alert-success">
<b>`Strings` are a common data type in programming languages. They are ordered collections of characters, and typically represent human-readable text</b>
</div>
In Python strings are defined using double quotes or single quotes - it doesn't really matter but they have to match.
Strings can be added together (concatenated) with the + operation.
```python
Assigning a string to a variable
name = "Hello"
Concatenating and printing strings
message = name + " world!"
print(message)
```
End of explanation
# Define a string
# Use string formatting to place a string and an integer into another string
# Define a numerical value
# Represent the numeric value in two different formats
Explanation: It is very common to want to combine strings together into longer text, often including numbers or other values. A widely used approach to string formatting is percentage sign place holders:
%s to insert a string
%i to insert an integer number
%f to insert a floating point number
```python
Define a string
name = "Leighton"
Use string formatting to place a string and an integer into another string
message = "Hello %s, your name has %i letters" % (name, len(name))
print(message)
```
```python
Define a numerical value
my_value = 3
Represent the numeric value in two different formats
print("This is an integer: %i" % my_value)
print("This is a floating point (real) number: %f" % my_value)
```
(This convention was introduced in the C programming language, which was enormously influential in later programming language design, so this is seen in many different languages.)
End of explanation
# Create a list of strings
# Create a list of several data types
Explanation: <a id="python_lists"></a>
3. Lists
<p></p>
<div class="alert-success">
<b>The Python `list` serves as a general purpose data structure for holding an *ordered* collection of values.</b>
</div>
This is similar to an array in other languages, and is commonly used in conjunction with a for loop as shown later. 
You can have a list of strings, a list of integers, etc. - and you can even mix several types of data in the same list.
The length of a list is defined as the number of elements in the list.
```python
Create a list of strings
names = ["Peter", "Sue", "Leighton"]
print(len(names))
```
```python
Create a list of several data types
things = ["a name", 3.5, names]
print(things)
```
End of explanation
# Create a string
# Loop over each letter in the string and print it
Explanation: <a id="for_loops"></a>
4. for loops
<p></p>
<div class="alert-success">
<b>`for` loops are a very common programmatic way to iterate over a number of items in a sequence (and then do something with each item)</b>
</div>
Most programming languages, including Python, have several ways to repeat a block of code multiple times.
Python's for loop works with a loop variable (letter in the example below) which takes in turn each of the values to be looped over (here the letters in the string variable message):
```python
Create a string
message = "Hello world"
Loop over each letter in the string and print it
for letter in message:
    print(letter)
```
End of explanation
# Loop over a list and print each element
Explanation: Another common situation is to loop over a list of values:
```python
Loop over a list and print each element
for value in ["alpha", "beta", "gamma", "delta"]:
    print(value)
```
End of explanation
# The Python keyword def is short for 'define'
# Here you are defining a function taking one argument
# Make a message three times
print(make_message("Peter"))
print(make_message("Sue"))
print(make_message("Leighton"))
Explanation: Elsewhere in the workshop you'll see this syntax used with other constructs.
<a id="functions"></a>
5. Defining Functions
<p></p>
<div class="alert-success">
<b>Often as your Python code gets longer you will find you repeat snippets of code.
<br></br><br></br>
It is usually best to turn the repeated code into a *function* which can be defined once and then used multiple times.</b>
</div>
This reduces the amount of typing you have to do
It also reduces the opportunity for introducing mistakes through typos and other errors
```python
The Python keyword def is short for 'define'
Here you are defining a function taking one argument
def make_message(name):
    length = len(name)
    # Python keyword 'return' exits the function with this value:
    return "Hello %s, your name is %i characters long" % (name, length)
```
End of explanation
# Assumes you've already executed the cells above which defined
# the list 'names' and the function 'make_message'
Explanation: <p><p><div class="alert-info">
`for` loops are very important for reducing duplicated code so in this example, rather than calling our function three times, we could do this:
</div>
```python
# Assumes you've already executed the cells above which defined
# the list 'names' and the function 'make_message'
for name in names:
    print(make_message(name))
```
End of explanation
# Define a function that returns the frequency with which
# the character 'letter' occurs in the string 'text'
def letter_frequency(text, letter):
    return text.count(letter) / len(text)
# This can be used as a rudimentary base frequency calculator
sequence = "AGTGACACAGGT"
for base in "ACGT":
    print("Frequency of letter %s is %f" % (base, letter_frequency(sequence, base)))
Explanation: The examples we have shown so far are functions taking a single argument, but they can take multiple arguments. Even optional arguments are possible (not shown here). 
The example below is a function which requires two arguments, and we combine it with a list to make a rudimentary base frequency calculator:
End of explanation
# Examples of some methods of a string
print(message.upper())
print(message.lower())
print(message.count("l"))
Explanation: <p><p><div class="alert-info">
This example also introduced something new for counting the letters in a string. `Python` strings have lots of *methods*, a special kind of `Python` function acting on the the object itself via this `.method(...)` syntax.
</div>
End of explanation
<END_TASK>