# File: DNA.py # Description: This program will ask the user to enter two strands of DNA # and compare the sequences # Assignment Number: 8 # # Name: Nina Le # EID: ntl277 # Course Name: CS303E # # Unique Number: 53185 # # Date created: 4/12/13 # Date last modified: 4/18/13 # # Slip days used on this assignment: 1 # Total slip days used: 1 # function that prompts the user for two strands and returns a tuple containing the two DNA strands def getStrands(): dna1=raw_input("Please enter a strand of DNA: ") dna2=raw_input("Please enter another strand of DNA: ") return (dna1, dna2) # function written by you that accepts two DNA sequences and returns the length of the longest # common subsequence of the two strands def longestCommonSubseq(dna1, dna2): if len(dna1)<len(dna2): string.find(dna1, dna2) first=[] second=[] for i in range(len(dna1)): first+= dna1[i] for i in range(len(dna2)): second+= dna2[i] length= # function written by you that accepts three parameters: 2 DNA strands and a length, in that order. # The function finds all common subsequences of the specified length and prints them to the screen. def printCommonSubseqs(): def main(): tuple= getStrands() lonest main()
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question