Nadiya Sitdykova
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # DNA Analysis Rubric ## Table of content 1. Function `read_dna()` [16 pts] ``` python def read_dna(dna_file): dna_data = "" with open(dna_file, 'r') as f: for line in f: dna_data += line return dna_data ``` * [Step 3](#step3) [3 pts] * [Step 4](#step4) [2 pts] * [Step 5](#step5) [4 pts] * [Step 6](#step6) [3 pts] * [Step 7](#step7) [2 pts] * [Step 8](#step8) [2 pts] 2. Function `dna_codons()` [18 pts] ``` python def dna_codons(dna): codons = [] for i in range(0, len(dna), 3): if (i + 3) < len(dna): codons.append(dna[i:i+3]) return codons ``` * [Step 10](#step10) [3 pts] * [Step 11](#step11) [2 pts] * [Step 12](#step12) [4 pts] * [Step 13](#step13) [3 pts] * [Step 14](#step14) [4 pts] * [Step 15](#step15) [2 pts] 3. Function `match_dna()` [15 pts] ``` python def match_dna(dna): matches = 0 for codon in dna: if codon in sample: matches += 1 return matches ``` * [Step 16](#step16) [3 pts] * [Step 17](#step17) [2 pts] * [Step 18](#step18) [3 pts] * [Step 19](#step19) [3 pts] * [Step 20](#step20) [2 pts] * [Step 21](#step21) [2 pts] 4. Function `is_criminal()` [18 pts] ``` python def is_criminal(dna_sample): dna_data = read_dna(dna_sample) codons = dna_codons(dna_data) num_matches = match_dna(codons) if num_mathces >= 3: print "%d matches found. Continue investigation." % num_matches else: print "$d matches found. Free suspect." % num_matches ``` * [Step 22](#step22) [3 pts] * [Step 23](#step23) [2 pts] * [Step 24](#step24) [2 pts] * [Step 25](#step25) [2 pts] * [Step 26](#step26) [2 pts] * [Step 27](#step27) [3 pts] * [Step 28.1](#step28_1) [1 pts] * [Step 28.2](#step28_2) [3 pts] 5. Function calls [2 pts] ``` python is_criminal("suspect1.txt") is_criminal("suspect1.txt") is_criminal("suspect1.txt") ``` * [Step 29](#step29) [2 pts] <div id='step3'/> ### Step 3 * _3 points (correct)_ ``` python def read_dna(dna_file): ... ``` * _2 points_ One minor typo/error * One of parenthesis is mistyped (square bracket or curly brace). ``` python def read_dna(dna_file}: ``` * There is semicolon at the end of the statement instead of colon. ``` python def read_dna(dna_file); ``` * Next statement is not indented. ``` python def read_dna(dna_file): ... ``` * User defines `dna_file` using other words. ``` python def read_dna(genome_file): ``` * Wrong keyword instead of `def` ``` python Def read_dna(dna_file): ``` ``` python class read_dna(dna_file): ``` * _1 point_ More than one minor errors: * Anything other than parentheses are used at both ends. ``` python def read_dna[dna_file]: ``` * Combination of various minor errors ``` python def read_dna{dna_file); ``` or one major error: * Function without parameter. ``` python def read_dna(): ``` * Missing colon at the end. ``` python def read_dna(dna_file) ``` * Adding equal sign (or any other symbol) after `read_dna`. ``` python def read_dna = (dna_file): ``` * _0 points_ * One major and one or more minor or major errors ``` python Def read_dna(): ``` * Keyword `def` is missing. The rest of the statement does not matter - the coder automatically receives 0 points. ``` python read_dna(dna_file): ``` * There is no attempt at defining function. _______________________________________________________________ <div id='step4'/> ### Step 4 * _2 points (correct)_ ``` python dna_data = "" ``` or ``` python dna_data = '' ``` * _1 point_ Only one of the following errors: * Typo/error in variable name ``` python dnas_data = "" ``` * String contains space ``` python dna_data = " " ``` * Two different types of quotes are used ``` python dna_data = "' ``` * Using `==` or `:` to assign value ``` python dna_data == "" ``` * _0 points_ * Two of more errors from previous case ``` python dna_data : '" ``` * Assigning anything else than empty string ``` python dna_data = [] ``` ``` python dna_data = str() ``` * Entire statement missing _______________________________________________________ <div id='step5'/> ### Step 5 * _4 points_ (correct) ``` python with open(dna_file, 'r') as f: ... ``` or ``` python with open(dna_file, "r") as f: ``` * _3 points_ All components are included in the correct order with one minor typo/error * Wrong variable name instead of `dna_file` or `f` ``` python with open(dna_file, 'r') as file: ``` * One of the parentheses is mistyped (square bracket or curly brace) ``` python with open[dna_file, 'r') as f: ``` * There is semicolon at the end of the statement instead of colon ``` python with open(dna_file, 'r') as f; ``` * File opened in wrong mode ``` python with open(dna_file, 'r+') as f: ``` ``` python with open(dna_file, 'w') as f: ``` * Missing quotes around mode ``` python with open(dna_file, r) as f: ``` * Quotes around variable `dna_file` ``` python with open("dna_file", "r") as f: ``` * Followin statement is not indented ``` python with open(dna_file, 'r') as f: ... ``` * Missing `as f` in the end ``` python with open(dna_file, 'r'): ``` * _2 points_ More than one minor type/error * Anything other than parentheses are used on both ends ``` python with open{dna_file, 'r'} as f: ``` * Combination of vairous errors listed in previous case ``` python with open(dna_file, 'w') as f; ``` or one major error: * Attempt to open file without mode parameter: ``` python with open(dna_file) as f: ``` * Missing colon at the end ``` python with open(dna_file, 'r') as f ``` * Using equal sign to define `f` ``` python with f = open(dna_file, 'r'): ``` * Missing `open` ``` python with (dna_file, 'r') as f: ``` * _1 point_ One major and one or more minor errors ``` python with open(dna_file, r) as f ``` ``` python with f = open("dna_file", "r"): ``` * _0 points_ * More the one major error ``` python with f = open(dna_file): ``` * No attempt at opening file _________________________________________________________________ <div id='step6'/> ### Step 6 * _3 points (correct)_ ```python for line in f: ... ``` * _2 points_ One of the following minor typos/errors: * There is semicolon at the end of statement instead of colon ``` python for line in f; ``` * Next statement is not indented ``` python for line in f: ... ``` * Typo/error in one variable name ``` python for lines in f: ``` ``` python for line in dna_file: ``` * _1 point_ More than one minor typos/errors * Typo/error in both variable names ``` python for lines in file: ``` * Two or more errors from previous case ``` python for line in f; ... ``` Or one major error * Missing colon at the end of statement ``` python for line in f ``` * Using `from` instead of `in ``` python for line from f: ``` * _0 points_ * One major and one or more other major/minor errors ``` python for line from f; ``` * Missing component(s) of statement ``` python line in f: ``` ``` python for line: ``` * Entire statement is missing _________________________________________ <div id='step7'/> ### Step 7 * _2 points (correct)_ ``` python dna_data += line ``` * _1 point_ * Typo/error in the name of one of the variables ``` python dna_line += line ``` ``` python dna_data += lines ``` * Addition done without using `+=` ``` python dna_data = dna_data + line ``` * _0 points_ * Typos/errors in the names of both variables ``` python dna_datas += lane ``` * Wrong order of variables ``` python line += dna_data ``` * Equal sign used simultaneously with `+=` ``` python dna_data = line += dna_data ``` * Concatenating `dna_data`: ``` python dna_data += dna_data + line ``` * Entire statement missing ________________________________________________ <div id='step8'/> ### Step 8 * _2 points (correct)_ ``` python def read_dna(dna_file): ... with ... for ... ... return dna_data 🔴 ``` * _1 point_ One of the following: * Typo/error in variable name or wrong variable returned (anything different than `dna_data` is returned) ``` python return dan_data ``` ``` python return dna_file ``` * No variable returned ``` python return ``` * Wrong identation ``` python def read_dna(dna_file): ... with ... for ... ... return dna_data 🔴 ``` ``` python def read_dna(dna_file): ... with ... for ... ... return dna_data 🔴 ``` * _0 points_ * Two or more errors from previous case ``` python def read_dna(dna_file): ... with ... for ... ... return ``` * Entire statement is missing ________________________________________________________ <div id='step10'/> ### Step 10 * _3 points (correct)_ ``` python def dna_codons(dna): ... ``` * _2 points_ There is minor type/error * One of parenthesis is mistyped (square bracket or curly brace). ``` python def dna_codons(dna}: ``` * There is semicolon at the end of the statement instead of colon. ``` python def dna_codons(dna); ``` * Next statement is not indented. ``` python def dna_codons(dna): ... ``` * Typo/mistake in the paramter name `dna` ``` python def dna_codons(den): ``` * Wrong keyword instead of `def` ``` python Def dna_codons(dna): ``` ``` python class dna_codons(dna): ``` * _1 point_ More than one minor error: * Anything other than parenthesis are used at both ends. ``` python def dna_codons[dna]: ``` * Combination of various minor errors ``` python class dna_codons(dna); ``` Or one major error: * Function without parameter. ``` python def dna_codons(): ``` * Missing colon at the end. ``` python def dna_codons(dna) ``` * Adding equal sign (or any other symbol) after `read_dna`. ``` python def dna_codons = (dna): ``` * _0 points_ * One major and one or more major or minor errors ``` python Def dna_codons = (dna): ``` * Keyword `def` is missing. The rest of the statement does not matter - the coder automatically receives 0 points. ``` python read_dna(dna_file): ``` * There is no attempt at defining function. _________________________________________________________ <div id='step11'/> ### Step 11 * _2 points (correct)_ ``` python codons = [] ``` * _1 point_ Only one of the following errors: * Typo/error in variable name ``` python data = [] ``` * One of parenthesis is wrong (square bracket or curly brace) ``` python codons = [) ``` * Using `==` or `:` to assign value ``` python codons == [] ``` * _0 points_ * Two of more errors from previous case ``` python dna_data == [] ``` * Assigning anything else than empty list ``` python codons = "" ``` ``` python codons = {} ``` * Entire statement missing ________________________________________________ <div id='step12'/> ### Step 12 * _4 points (correct)_ ``` python for i in range(0, len(dna), 3): ... ``` * _3 points_ All components are included except one of them minor type/error * One wrong paranthesis (square bracket or curly brace) in calls of `range()` or `len()` ``` python for i in range(0, len(dna), 3]: ``` ``` python for i in range(0, len{dna), 3): ``` * There is semicolon at the end of the statement instead of colon ``` python for i in range(0, len(dna), 3); ``` * Next statement is not indented ``` python for i in range(0, len(dna), 3): ... ``` * Something different used instead of `range()`, `len()`, `dna` or `i` ``` python for i in ragne(0, len(dna), 3): ``` ``` python for i in range(0, length(dna), 3): ``` ``` python for i in range(0, len(dna_data), 3): ``` * _2 points_ There are multiple minor errors * More than one wrong parenthesis (square bracket or curly brace) ``` python for i in range[0, len(dna_data), 3]: ``` * Combination of various errors from previous case ``` python for i in range(0, length(dna), 3); ``` Or one major error * Different order of `range()` parameters ``` python for i in range(0, 3, len(dna)): ``` * Missing parameter in `range()` ``` python for i in range(0, len(dna)): ``` * Using equal sign or colon insted of `in` ``` python for i : range(0, len(dna), 3): ``` * Keyword `for` is missing ``` python i in range(0, len(dna), 3) ``` * _1 point_ * One major and one minor error ``` python for i in ragne(0, 3, len(dna)): ``` * List slicing signature used for range with right order of parameters ``` python for i in range(0:len(dna):3): ``` or ``` python for i in range(0::3): ``` * Missing colon at the end ``` python for i in range(0, len(dna), 3) ``` * _0 points_ * One major and more than one minor errors ``` python for i in range(0, len(dna)); ... ``` * Two major errors ``` python for i = range(len(dna), 0) ``` * Entire statement is missing ____________________________________________________________ <div id='step13'/> ### Step 13 * _3 points (correct)_ ``` python if i + 3 < len(dna): ... ``` or ``` python if (i + 3) < len(dna): ... ``` * _2 points_ One minor typo/error * One wrong parenthesis (square bracket or curly brace) ``` python if i + 3 < len(dna]: ``` * Semicolon at the end ``` python if i + 3 < len(dna); ``` * Next statement is not indented ``` python if i + 3 < len(dna): ... ``` * Any other variable name instead of `dna` ``` python if i + 3 < len(codons): ``` * Typo/error in `len()` name ``` python if i + 3 < length(dna): ``` * Length referred as a property ``` python if i + 3 < dna.length ``` * _1 point_ Multiple minor errors * Both parentheses are wrong (square brackets or curly braces) ``` python if i + 3 < len[data]: ``` * Combination of different errors from previous case ``` python if i + 3 < length(dna); ``` Or one major error * Missing colon at the end ``` python if i + 3 < len(dna) ``` * Wrong comparison sign ``` python if i + 3 <= len(dna): ``` ``` python if i + 3 > len(dna): ``` * Wrong left side of comparison ``` python if i < len(dna): ``` ``` python if len(i) < len(dna): ``` * _0 points_ * One major + one or more major or minor errors ``` python if i + 3 <= dna.length(): ``` * Missing keyword `if` ``` python i + 3 < len(dna): ``` * Entire statement is missing _______________________________________________________ <div id='step14'/> ### Step 14 * _4 points (correct)_ ``` python codons.append(dna[i:(i+3)]) ``` or ``` python codons.append(dna[i:i+3]) ``` * _3 points_ One minor typo/error * One wrong parenthesis (square bracket or curly brace) ``` python codons.append[dna[i:i+3]) ``` ``` python codons.append(dna{i:i+3]) ``` * Typo/error in one variable name `codons` or `dna` ``` python codon.append(dna[i:i+3]) ``` ``` python codons.append(codon[i:i+3]) ``` * _2 points_ More than one minor typo/error * Wrong pair(s) of parentheses (square brackets or curly braces) ``` python codons.append[dna[i:i+3]] ``` * Combination of errors from previous case ``` python dna.append(dna[i:i+3)) ``` Or one major error * Wrong part of `dna` taken (anything different than `i:i+3` within `[]` following `dna`) ``` python codons.append(dna[i]) ``` ``` python codons.append(dna[1:4]) ``` * Result of `append()` assigned to `codons` ``` python codons = codons.append(dna[i:i+3]) ``` * _1 point_ * One major and one or more major or minor errors ``` python codons = codons.append(dna(i:i+3)) ``` ``` python codons.append(codon[i+3]) ``` * Only `codons.append()` called right, but the value in `()` has nothing common with `dna[i:i+3]` ``` python codons.append(range(3)) ``` ``` python codons.append(len(dna)) ``` ``` python codons.append("GTA") ``` * _0 points_ * Fail to call `codons.append()` correctly and there is nothing similar to `dna[i:i+3]` ``` python codons = codons.append(i) ``` ``` python codons.append[i] ``` * Entire statement is missing _________________________________________________________ <div id='step15'/> ### Step 15 * _2 points (correct)_ ``` python def dna_codons(dna): ... for ... if ... ... return codons 🔴 ``` * _1 point_ One of the following: * Typo/error in variable name or wrong variable returned (anything different than `codons` is returned) ``` python return codon ``` ``` python return i + 3 ``` * No variable returned ``` python return ``` * Wrong identation ``` python def dna_codons(dna): ... for ... if ... ... return codons 🔴 ``` ``` python def dna_codons(dna): ... with ... for ... ... return codons 🔴 ``` * _0 points_ * Two or more errors from previous case ``` python def dna_codons(dna): ... for ... if ... ... return dna 🔴 ``` * Entire statement is missing _____________________________________________________________ <div id='step16'/> ### Step 16 * _3 points (correct)_ ``` python def match_dna(dna): ... ``` * _2 points_ One minor typo/error * One of parenthesis is mistyped (square bracket or curly brace). ``` python def match_dna(dna}: ``` * There is semicolon at the end of the statement instead of colon. ``` python def match_dna(dna); ``` * Next statement is not indented. ``` python def match_dna(dna): ... ``` * Typo/mistake in the paramter name `dna` ``` python def match_dna(codon): ``` * Wrong keyword instead of `def` ``` python Def match_dna(dna): ``` ``` python class match_dna(dna): ``` * _1 point_ More than one minor error: * Anything other than parenthesis are used at both ends. ``` python def match_dna[dna]: ``` * Combination of various minor errors ``` python class match_dna(dna); ``` Or one major error: * Function without parameter. ``` python def match_dna(): ``` * Missing colon at the end. ``` python def match_dna(dna) ``` * Adding equal sign (or any other symbol) after `read_dna`. ``` python def match_dna == (dna): ``` * _0 points_ * One major and one or more minor or major errors ``` python def match_dna(dna) ... ``` * Keyword `def` is missing. The rest of the statement does not matter - the coder automatically receives 0 points. ``` python match_dna(dna): ``` * There is no attempt at defining function. ________________________________________________________ <div id='step17'/> ### Step 17 * _2 points (correct)_ ``` python matches = 0 ``` * _1 point_ One minor type/error * Type/error in variable name ``` python match = 0 ``` * Using `==` or `:` instead of `=`: ``` python matches == 0 ``` * Zero is a string (taken into quotes) ``` python matches = "0" ``` * _0 points_ * More than one minor errors ``` python matches : "0" ``` * Entire statement is missing _________________________________________________________ <div id='step18'/> ### Step 18 * _3 points (correct)_ ``` python for codon in dna: ... ``` * _2 points_ One of the following minor typos/errors: * There is semicolon at the end of statement instead of colon ``` python for codon in dna; ``` * Next statement is not indented ``` python for codon in dna: ... ``` * Typo/error in one variable name ``` python for item in dna: ``` ``` python for codon in dna_file: ``` * Unnecessary `list()` ``` python for codon in list(dna): ``` * _1 point_ More than one minor typos/errors * Typo/error in both variable names ``` python for item in dna_data: ``` * Two or more errors from previous case ``` python for codon in dna; ... ``` Or one major error * Missing colon at the end of statement ``` python for codon in dna ``` * Using `from` instead of `in ``` python for codon from dna: ``` * _0 points_ * One major and one or more other major/minor errors ``` python for codon from dna; ``` * Missing component(s) of statement ``` python codon in dna: ``` ``` python for codon: ``` * Entire statement is missing ______________________________________________________________ <div id='step19'/> ### Step 19 * _3 points (correct)_ ``` python if codon in sample: ... ``` * _2 points_ One minor typo/error * Semicolon at the end ``` python if codon in sample; ``` * Next statement is not indented ``` python if codon in sample: ... ``` * Any other variable name instead of `sample` ``` python if codon in dna: ``` * _1 point_ Multiple minor errors * Combination of different errors from previous case ``` python if codon in dna_file; ``` Or one major error * Using `from` or `is in` instead of `in` ``` python if codon from sample: ``` ``` python if codon is in sample: ``` * Check of equality: ``` python if codon == sample: ``` * Using `not` ``` python if codon not in sample: ``` * _0 points_ * One major + one or more minor errors ``` python if codon in dna_file: ... ``` * Equal sign or any other symbol(s) between`codon` and `sample` ``` python if codon = sample: ``` * Missing keyword `if` ``` python codon in sample: ``` * Entire statement is missing _________________________________________________________________ <div id='step20'/> ### Step 20 * _2 points (correct)_ ``` python matches += 1 ``` * _1 point_ * Typo/error in variable name ``` python match += 1 ``` * _0 points_ * Anything else than `1` on a right side of `+=` ``` python matches += matches + 1 ``` ``` python matches += 3 ``` * Another assignment (`=`) is used in statement ``` python matches = matches += 1 ``` * Entire statement is missing _____________________________________________________________________ <div id='step21'/> ### Step 21 * _2 points (correct)_ ``` python def match_dna(dna): ... for ... if ... ... return matches 🔴 ``` * _1 point_ One of the following: * Typo/error in variable name or wrong variable returned (anything different than `codons` is returned) ``` python return sample ``` ``` python return match_dna() ``` * No variable returned ``` python return ``` * Wrong identation ``` python def match_dna(dna): ... for ... if ... ... return matches 🔴 ``` ``` python def match_dna(dna): ... with ... for ... ... return matches 🔴 ``` * _0 points_ * Two or more errors from previous case ``` python def match_dna(dna): ... for ... if ... ... return 🔴 ``` * Entire statement is missing _____________________________________________________________ <div id='step22'/> ### Step 22 * _3 points(correct)_ ``` python def is_criminal(dna_sample): ... ``` * _2 points_ One minor typo/error * One of parenthesis is mistyped (square bracket or curly brace). ``` python def is_criminal(dna_sample}: ``` * There is semicolon at the end of the statement instead of colon. ``` python def is_criminal(dna_sample); ``` * Next statement is not indented. ``` python def is_criminal(dna_sample): ... ``` * Typo/mistake in the paramter name `dna_sample` ``` python def is_criminal(dna): ``` * Wrong keyword instead of `def` ``` python Def is_criminal(dna_sample): ``` ``` python class is_criminal(dna_sample): ``` * _1 point_ More than one minor errors: * Anything other than parenthesis are used at both ends (square brackets or curly braces). ``` python def is_criminal[dna_sample]: ``` * Combination of various minor errors ``` python class is_criminal(dna_sample); ``` Or one major error: * Function without parameter. ``` python def is_criminal(): ``` * Missing colon at the end. ``` python def is_criminal(dna_sample) ``` * Adding equal sign (or any other symbol) after `is_criminal`. ``` python def is_criminal == (dna_sample): ``` * _0 points_ * One major and one or more minor or major errors ``` python def is_criminal[] ``` * Keyword `def` is missing. The rest of the statement does not matter - the coder automatically receives 0 points. ``` python is_criminal(dna_sample): ``` * There is no attempt at defining function. _______________________________________________________ <div id='step23'/> ### Step 23 * _2 points(correct)_ ``` python dna_data = read_dna(dna_sample) ``` * _1 point_ * Function call does not include arguments (there is nothing inside parentheses). ``` python dna_data = read_dna() ``` * Uses anything other than parentheses, e.g. square brackets or curly braces. ``` python dna_data = read_dna[dna_sample] ``` * One typo/error in any variable name ``` python den_data = read_dna(dna_sample) ``` ``` python dna_data = read(dna_sample) ``` ``` python dna_data = read_dna(dna) ``` * Assigning value with `==` or `:` instead of `=` ``` python dna_data == read_dna(dna_sample) ``` * Using parentheses after parameter `dna_sample` ``` python dna_data = read_dna(dna_sample()) ``` * Using `:` in the end of the statement ``` python dna_data = read_dna(dna_sample): ``` * _0 points_ * More than one error from previous case ``` python dna_data : read_dna() ``` * Function name `read_dna` and parameter `dna_sample` are swapped ``` python dna_data = dna_sample(read_dna) ``` * There is no attempt to call the function ________________________________________________________ <div id='step24'/> ### Step 24 * _2 points(correct_) ``` python codons = dna_codons(dna_data) ``` * _1 point_ * Function call does not include arguments (there is nothing inside parentheses). ``` python codons = dna_codons() ``` * Uses anything other than parentheses, e.g. square brackets or curly braces. ``` python codons = dna_codons{dna_data} ``` * One typo/error in any variable name ``` python codon = dna_codons(dna_data) ``` ``` python codons = dna_codon(dna_data) ``` ``` python codons = dna_codons(dna_sample) ``` * Assigning value with `==` or `:` instead of `=` ``` python codons == dna_codons(dna_data) ``` * Using parentheses after parameter `dna_sample` ``` python codons = dna_codons(dna_data()) ``` * Using `:` in the end of the statement ``` python codons = dna_codons(dna_data): ``` * _0 points_ * More than one error from previous case ``` python codons == dna_codons(dna_data()) ``` * Function name `dna_codons` and parameter `dna_data` are swapped ``` python codons = dna_data(dna_codons) ``` * Any additional values in right side of statement ``` python codons = dna_data + dna_codons(dna_data) ``` * There is no attempt to call the function ______________________________________________________ <div id='step25'/> ### Step 25 * _2 points (correct)_ ``` python num_matches = match_dna(codons) ``` * _1 point_ * Function call does not include arguments (there is nothing inside parentheses). ``` python num_matches = match_dna() ``` * Uses anything other than parentheses, e.g. square brackets or curly braces. ``` python num_matches = match_dna[codons] ``` * One typo/error in any variable name ``` python matches = match_dna(codons) ``` ``` python num_matches = match_dne(codons) ``` ``` python num_matches = match_dna(dna_data) ``` * Assigning value with `==` or `:` instead of `=` ``` python num_matches == match_dna(codons) ``` * Using parentheses after parameter `dna_sample` ``` python num_matches = match_dna(codons()) ``` * Using `:` in the end of the statement ``` python num_matches = match_dna(codons): ``` * _0 points_ * More than one error from previous case ``` python num_matches : match_dna[codons] ``` * Function name `match_dna` and parameter `codons` are swapped ``` python num_matches = codons(match_dna) ``` * There is no attempt to call the function _____________________________________________________ <div id='step26'/> ### Step 26 * _2 points (correct)_ ``` python if num_matches >= 3: ... ``` * _1 point_ One minor type/error * Semicolon at the end ``` python if num_matches >= 3; ``` * Next statement is not indented ``` python if num_matches >= 3: ... ``` * Any other variable name instead of `num_matches` ``` python if matches >= 3: ``` * Wrong comparison sign ``` python if num_matches > 3: ``` ``` python if num_matches == 3: ``` * _0 points_ * More than one typo/error from previous case ``` python if matches < 3: ``` * Missing colon at the end ``` python if num_matches <= 3 ``` * Space within comparison sign ``` python if num_matches > = 3: ``` * Missing keyword `if` ``` python i + 3 < len(dna): ``` * Entire statement is missing _____________________________________________________ <div id='step27'/> ### Step 27 * _3 points (correct)_ All components are included in the correct order ``` python print "%d matches. Continue investigation." % num_matches ``` * _2 points_ All components are included in the correct order with one minor typo/error * Did not include `%d` inside the quotations ``` python print " matches. Continue investigation." % num_matches ``` * Did not include `%` between `"%s"` and `num_matches` ``` python print "%d matches. Continue investigation." num_matches ``` * Did not include `num_matches` at the end or used another variable name ``` python print "%d matches. Continue investigation." % ``` ``` python print "%d matches. Continue investigation." % dna_matches ``` * Used a letter other than `d` when typing `%d` inside the quotations ``` python print "%f matches. Continue investigation." % num_matches ``` * _1 point_ There are repeated/multiple errors (combination of errors listed in the previous case) ``` python print "%d matches, num_matches" ``` ``` python print "Continue investigation." % ``` Or missing `print` ``` python "%d matches. Continue investigation" % num_matches ``` * _0 points_ * Coder does not use or attempt the proper string formatting syntax requested by the activity ``` python print str(num_matches) + " matches. Continue investigation." ``` ``` python print str(num_matches), "Continue investigation." ``` * Only simple string message is printed ``` python print "Continue investigation" ``` * There is no attempt to create print statement ________________________________________________________ <div id='step28_1'/> ### Step 28.1 * _1 point (correct)_ `else` on the same level as `if` ``` python if ...: ... else:🔴 ... ``` * _0 points_ * Indented within `if` block ``` python if ...: ... else:🔴 ``` * Next statement is not indented ``` python else: ... ``` * Missing colon in the end ``` python else ``` * Next statement written in the same line ``` python else: print "%d matches. Free suspect." ``` <div id='step28_2'/> ### Step 28.2 * _3 points (correct)_ ``` python print "%d matches. Free suspect." % num_matches ``` * _2 points_ All components are included in the correct order with one minor typo/error * Did not include `%d` inside the quotations ``` python print "matches. Free suspect." % num_matches ``` * Did not include `%` between `"%s”` and `num_matches` ``` python print "%d matches. Free suspect." num_matches ``` * Did not include `num_matches` at the end or used another variable name ``` python print "%d matches. Free suspect." % ``` ``` python print "%d matches. Free suspect." % dna_matches ``` * Used a letter other than `d` when typing `%d` inside the quotations ``` python print "%f matches. Free suspect." % num_matches ``` * _1 point_ There are repeated/multiple errors (combination of errors listed in the previous case) ``` python print "%d matches, num_matches" ``` ``` python print "Free suspect." % ``` Or missing `print` ``` python "%d matches. Free suspect" % num_matches ``` * _0 points_ * Coder does not use or attempt the proper string formatting syntax requested by the activity ``` python print str(num_matches) + " matches. Free suspect." ``` ``` python print str(num_matches), "Free suspect." ``` * Only simple string message is printed ``` python print "Free suspect" ``` * There is no attempt to create print statement _________________________________________________________ <div id='step29'/> ### Step 29 * _2 points (correct)_ ``` python is_criminal("suspect1.txt") is_criminal("suspect2.txt") is_criminal("suspect3.txt") ``` or ``` python is_criminal('suspect1.txt') is_criminal('suspect2.txt') is_criminal('suspect3.txt') ``` * _1 point_ * Does not include arguments (there is nothing inside the parentheses). ``` python is_criminal() ``` * Uses anything other than parentheses, e.g. square brackets or curly braces. ``` python is_criminal["suspect1.txt"] ``` * Missing quotes around file name ``` python is_criminal(suspect1.txt) ``` * Any sort of minor error, e.g. misspellings or adding a colon at the end. ``` python is_criminals("suspect1.txt"): ``` * Using `print` ``` python print is_criminal("suspect1.txt") ``` * _0 points_ * Only has `is_criminal` (no attempt to pass arugments or include parentheses). ``` python is_criminal ``` * Using `.txt` outside of file name ``` python is_criminal("suspect1.txt").txt ``` ``` python is_criminal.txt(suspect1) ``` * Combinations of multiple errors from previous case ``` python is_criminal(suspect1.txt): ``` * There is no attempt to call function

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully