100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.2 TrustPilot
logo-home
Summary

Summary Introduction to Programming for Biosciences Cheatsheet (5BBB0238)

Rating
-
Sold
-
Pages
12
Uploaded on
12-08-2025
Written in
2024/2025

A comprehensive, notes form summary/cheatsheet of the 5BBB0238 Introduction to Programming for Biosciences module at King's College London. It provides a completely beginner-friendly overview of everything you need to get started with Python programming, with particular relevance to use for biological applications such as genomic analysis. The key functions/commands/skills from all workshops and practice exercises are included in direct accordance with the module's learning objectives, with code examples highlighted in bold. I memorised this alone and came first in the year in the exams with 95%! Topics covered include variables, for loops, while loops, if/else statements, functions, dictionaries, tuples, images, files and equations so it will also be highly relevant for anyone wanting to learn to code with Python.

Show more Read less
Institution
Course









Whoops! We can’t load your doc right now. Try again or contact support.

Written for

Institution
Study
Unknown
Course

Document information

Uploaded on
August 12, 2025
Number of pages
12
Written in
2024/2025
Type
Summary

Subjects

Content preview

Cheatsheet
Reviewed



General
just type to write in code or begin line with # for comments

print(””) to display a string/phrase, use commas between to print several
variables

= to assign variable, == to check if true/false, ! = not equals



Variable types
Boolean = true/false or 0/1

String = text (“…”)

Int = integer (number)

Float = decimal number, be aware of floating point error eg. 1.2-1 gives
0.19999

List = […, …]

Tuple = (…, …)

Dictionary = {…, …}

to update a variable: eg. a=a+3 or a+=3, computer looks at right hand side of
equation first then assigns to left hand side

identify variable type with type(variablename)

word.isnumber() = checks if string can be converted to number, true/false
output eg. word.isnumber(’three’) would give true



If statements

Cheatsheet 1

, If… = checks if statement is true/false ie boolean

Elif… = comes after if, this second statement is only checked if first if is false

else… = final statement, carries out only if all previous are false

conditional statements: and (executes if both statements are true), or (if one
or both are true) not (switches true/false so executes if statement is not…)

Nested if statements:

if…
if…

inner if loop only runs if outer if statement is true



For loops
When to use: when you want to run a programme for a specified number of
times/in a specific range eg. printing the numbers of all the adenine bases in a
DNA sequence of set known length

How to construct a for loop:

for i in range():

command…

Using all three range arguments: range(start, stop+1, step) eg. range(2,11,2)
will give 2,4,6,8,10 use range(length(variable)) as stop value for words as
indexing already starts from 0

to loop backwards through a string/list: list = reversed(list) to update variable
to reversed version or newlist = list[::-1] or for i in range((length-1), -1, -1)

to break out of a loop (end it): break

Nested for loops eg.




Cheatsheet 2
$21.29
Get access to the full document:

100% satisfaction guarantee
Immediately available after payment
Both online and in PDF
No strings attached

Get to know the seller
Seller avatar
rcnotes
4.0
(1)

Get to know the seller

Seller avatar
rcnotes Kings College London
Follow You need to be logged in order to follow users or courses
Sold
3
Member since
4 months
Number of followers
1
Documents
22
Last sold
1 month ago
rcnotes

4.0

1 reviews

5
0
4
1
3
0
2
0
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Frequently asked questions