02-11-22-Lab-5-MS21212.ipynb - Colaboratory
02-11-22-Lab-5-MS21212.ipynb - Colaboratory
ipynb - Colaboratory
# Lists
l = [1,2,3]
# Set
s = set()
# Tuple
t = tuple(l)
# Dictionary
d = {}
bubbleSort(arr)
https://colab.research.google.com/drive/1r745sBGbyBEF4PXkhTK0R5kMvHBzfBel?authuser=1#scrollTo=-zv5m6MNPovJ&printMode=true 2/7
3/1/22, 1:07 PM 02-11-22-Lab-5-MS21212.ipynb - Colaboratory
di = []
for char1 in s :
for char2 in s :
di.append(char1 + char2)
monocounts = {}
for char in mono :
count = 0
for i in a:
if char == i :
count += 1
monocounts[char] = count
print("Count of respective mononucleotides" , monocounts)
sp=3
print(" "*sp)
dicount = {}
for char in di :
if char in a :
dicount[char] = a.count(char)
print("Count of respective dinucleotide ",dicount)
sp=3
print(" "*sp)
number of unique character 8 All possible mononucleotides are ['g', 't', 'a', 'A', 'c', 'T', 'C', 'G'] Count
of g is: 71 ; Count of t is: 53 ; Count of a is: 34 ; Count of A is: 172 ; Count of c is: 47 ; Count of T
is: 149 ; Count of C is: 177 ; Count of G is: 212 ;
All possible dinucleotidesare ['gg', 'gt', 'ga', 'gA', 'gc', 'gT', 'gC', 'gG', 'tg', 'tt', 'ta', 'tA', 'tc', 'tT', 'tC', 'tG',
'ag', 'at', 'aa', 'aA', 'ac', 'aT', 'aC', 'aG', 'Ag', 'At', 'Aa', 'AA', 'Ac', 'AT', 'AC', 'AG', 'cg', 'ct', 'ca', 'cA', 'cc', 'cT',
'cC', 'cG', 'Tg', 'Tt', 'Ta', 'TA', 'Tc', 'TT', 'TC', 'TG', 'Cg', 'Ct', 'Ca', 'CA', 'Cc', 'CT', 'CC', 'CG', 'Gg', 'Gt', 'Ga',
'GA', 'Gc', 'GT', 'GC', 'GG'] there are 64 combinations.
https://colab.research.google.com/drive/1r745sBGbyBEF4PXkhTK0R5kMvHBzfBel?authuser=1#scrollTo=-zv5m6MNPovJ&printMode=true 4/7
3/1/22, 1:07 PM 02-11-22-Lab-5-MS21212.ipynb - Colaboratory
count is 16 for gg ; count is 17 for gt ; count is 11 for ga ; count is 1 for gA ; count is 23 for gc ;
count is 0 for gT ; count is 0 for gC ; count is 0 for gG ; count is 27 for tg ; count is 9 for tt ; count
is 4 for ta ; count is 0 for tA ; count is 11 for tc ; count is 0 for tT ; count is 0 for tC ; count is 0 for
tG ; count is 8 for ag ; count is 10 for at ; count is 8 for aa ; count is 0 for aA ; count is 5 for ac ;
count is 0 for aT ; count is 0 for aC ; count is 0 for aG ; count is 0 for Ag ; count is 0 for At ; count
is 0 for Aa ; count is 43 for AA ; count is 0 for Ac ; count is 40 for AT ; count is 29 for AC ; count is
45 for AG ; count is 17 for cg ; count is 15 for ct ; count is 8 for ca ; count is 0 for cA ; count is 6
for cc ; count is 0 for cT ; count is 0 for cC ; count is 0 for cG ; count is 0 for Tg ; count is 0 for Tt ;
count is 0 for Ta ; count is 20 for TA ; count is 0 for Tc ; count is 22 for TT ; count is 37 for TC ;
count is 65 for TG ; count is 0 for Cg ; count is 0 for Ct ; count is 0 for Ca ; count is 30 for CA ;
count is 0 for Cc ; count is 40 for CT ; count is 39 for CC ; count is 63 for CG ; count is 0 for Gg ;
count is 0 for Gt ; count is 0 for Ga ; count is 63 for GA ; count is 1 for Gc ; count is 42 for GT ;
count is 67 for GC ; count is 35 for GG ; Count of respective mononucleotides {'g': 71, 't': 53, 'a':
34, 'A': 172, 'c': 47, 'T': 149, 'C': 177, 'G': 212}
Count of respective dinucleotide {'gg': 16, 'gt': 17, 'ga': 11, 'gA': 1, 'gc': 23, 'tg': 27, 'tt': 9, 'ta': 4, 'tc':
11, 'ag': 8, 'at': 10, 'aa': 8, 'ac': 5, 'AA': 43, 'AT': 40, 'AC': 29, 'AG': 45, 'cg': 17, 'ct': 15, 'ca': 8, 'cc': 6, 'TA':
20, 'TT': 22, 'TC': 37, 'TG': 65, 'CA': 30, 'CT': 40, 'CC': 39, 'CG': 63, 'GA': 63, 'Gc': 1, 'GT': 42, 'GC': 67,
'GG': 35}
if(sub == "maths") :
maths_total= maths [0] + maths [1] + maths [2] + maths [3] + maths [4]
performance_maths = maths_total/5
print('performane in maths', performance_maths)
elif (sub == "biology"):
biology_total= biology [0] + biology [1] + biology [2] + biology [3] + biology [4]
performance_biology = biology_total/5
print('performance in biology', performance_biology)
elif (sub == "chemistry"):
chemistry_total = chemistry [0] + chemistry[1] + chemistry[2] + chemistry[3] + chemistry
performance_chemistry = chemistry_total/5
print('performane in chemistry', performance_chemistry)
elif (sub == "physics"):
physics_total = physics [0] + physics [1] + physics [2] + physics [3] + physics [4]
performance_physics = physics_total/5
print('performance in physics', performance_physics)
#5)c) using dict
Adrian ={'Maths': 55,'Biology': 65 ,'Chemistry': 90 ,'Physics': 88 }
Jasuz ={'Maths': 75,'Biology': 64,'Chemistry': 95 ,'Physics': 96}
Jeffrey ={'Maths': 81,'Biology': 79,'Chemistry': 58,'Physics': 82}
Michal={'Maths': 79,'Biology':59,'Chemistry': 80 ,'Physics': 65}
Piotr ={'Maths': 85,'Biology': 81,'Chemistry': 78,'Physics': 80}
def average(subject):
x=( Adrian [ subject ]+ Jasuz [ subject ]+ Jeffrey [ subject ]+ Michal [ subject ]+Pio
print ( f' class average of { subject } is {x}')
average('Maths')
average('Biology')
average('Chemistry')
average ('Physics')
https://colab.research.google.com/drive/1r745sBGbyBEF4PXkhTK0R5kMvHBzfBel?authuser=1#scrollTo=-zv5m6MNPovJ&printMode=true 6/7
3/1/22, 1:07 PM 02-11-22-Lab-5-MS21212.ipynb - Colaboratory
https://colab.research.google.com/drive/1r745sBGbyBEF4PXkhTK0R5kMvHBzfBel?authuser=1#scrollTo=-zv5m6MNPovJ&printMode=true 7/7