phaget4.org - bioinformatics – biology and code work well together

Example domain paragraphs

biology and code work well together

When you need to do something involving a list in Python, either process an existing list or create a new list, there’s a kind of shorthand that can be used to do this in a single line between square brackets, called ‘List Comprehension’. Think of it as For loops within list brackets, with or without conditionals .

# given a list casual_names = ['alec','jude','malcolm'] capitalized_names = [name.title() for name in casual_names] You can add a conditional statement. For example, square all the even integers in a given range:

Links to phaget4.org (1)