-1

It's always coming out 44 and it's not in order

Can you give me a hint of what I'm doing wrong? Or what can I do or study to fix it? What should I learn? ,<<

Lara
  • 1
  • 5
  • 1
    Have you tried changing the line with `print` so that it prints what you want instead of what it currently prints? What exactly was the difficulty? – mkrieger1 Dec 01 '20 at 11:50
  • It's always coming out 44 and it's not in order.I don't know how to print correctly – Lara Dec 01 '20 at 11:57
  • @mkrieger1 Look if the question became clearer now, edited. – Lara Dec 01 '20 at 12:07
  • The reason is this: https://stackoverflow.com/questions/240178/list-of-lists-changes-reflected-across-sublists-unexpectedly. By `v[0] += 1` you are changing all elements of the list (because they are actually all the same element). – mkrieger1 Dec 01 '20 at 12:48
  • If you want to output the items in a specific order, you need to use the `sorted` function. – mkrieger1 Dec 01 '20 at 12:49

1 Answers1

1
odernation = customHash(someSequence)

for codon, cnt in d.items():
    print('{}. {}: {}'.format(odernation,codon, cnt))

odernation is only being computed once and then being printed in the for loop. The value isn't changing.

magikarp
  • 460
  • 1
  • 8
  • 22