본문 바로가기

Bioinformatics

Python1

dictionary

dic_a = {'English':'영어'} → dic_a ['English'] = '영어'

Usage

→dict_amino_acid = {'AUG':'Met', 'UGU':'Cys'}

→dict_amino_acid = {}

   dict_amino_acid['AUG'] = 'Met'

→key = ['AUG', 'UGU']

   value = ['Met', 'Cys']

   dict_amino_acid = dict(zip(key,value))

 

 

python coding

vi_file_name.py

python2_file_name.py

 

 

<python bulit-in functions>

input() - prompts the user for data that in converted to and returned as a integer

raw_input() - prompts the user for data that in converted to and returned as a string

Usage

→A = input("enter some integers")

→B = raw_input("enter some words")

 

if, elif, else

 

 

for - useful for limited loop

Usage

→for_variable_name_in_list_name : 

 

range() - makes a list of integer

- range(2) = [0,1]

- range(1,5) = [1,2,3,4]

- range(1,5,2) = [1,3]

 

len() - calculates length of a string or list

- len('ABC') = 3

- len([1,2]) = 2

 

while - useful for unlimited loop

Usage

→while_conditional_sentence :

 

 

 

 

 

 

 

'Bioinformatics' 카테고리의 다른 글

Python3  (0) 2023.01.05
Python2  (0) 2023.01.02
Linux - Ubuntu  (0) 2022.12.27
Sequence Alignment  (0) 2022.12.25
Genomics basic concept  (0) 2022.12.25