Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options not deleted user 31002

The problem set for Week 7

1 vote
Accepted

pset6 credit help with calculations in python

Unlike C, / will perform true floating point division in Python. To get integer division (and discard the remainder), use // instead. Regarding being stuck in the for loop, range(num) will loop all th …
Sentox's user avatar
  • 950
0 votes
Accepted

Getting ONE error on check50 for DNA - ValueError: max() arg is an empty sequence - Where is...

This error is just telling you that the dict d is empty (i.e. no matches were found). So you need to sanity check this. Replace: max_tuple = max(d.items(), key=lambda k: k[1]) max_value = max_tuple[1] …
Sentox's user avatar
  • 950
0 votes
Accepted

DNA - Getting the highest key value from a defaultdict

If you just want the highest value from a dict and you don't care about what key it's associated with, you can just do: max_value = max(d.values()) For the key of the max value: max_key = max(d, key= …
Sentox's user avatar
  • 950
1 vote
Accepted

check50 gives different output than my own for "18.txt" sequence. All others pass. Any thoug...

If you look at the databases, you'll see that Harry (which your code produces for sequence 18) is almost an exact match with one exception. Sequence 18 contains TCTG 41 times, rather than the 40 times …
Sentox's user avatar
  • 950
1 vote
Accepted

PSET 6 DNA - Computing STRs

What is the value of i when the function moves on to the next str?
Sentox's user avatar
  • 950
0 votes
Accepted

Pset6 mario more didn't pass the test

range(height) For a value of 4 as shown, will give [0, 1, 2, 3]. So the first iteration will print (3 - 0) spaces and 0 blocks.
Sentox's user avatar
  • 950
1 vote
Accepted

Computing consecutive STR is sometimes off by a little (Spoiler!)

Your problem is that the nucleotide loop steps through each letter of the sample, but when you find a match your index variable falls out of sync with the letter you are checking. I generally prefer n …
Sentox's user avatar
  • 950