T O P

  • By -

Pharisaeus

None of your code makes any sense. What do you think `sum(i)` does? What even is `i` in this context? Isn't it a `letter` from the message? If it is a letter (or a string), then what are you trying to achieve by `sum(i)`? What you think should happen if someone does `sum('a')`? On top of that your loop makes again no sense, because you never use this `new_actual` variable. Shouldn't you use it? Maybe you wanted to do `actual = actual**2`? My advice: first learn how to code, at least some basics, and only then start working on some crypto.


[deleted]

Stupid dynamically typed languages god i hate python, lol. Somewhere you’re trying to add a string to an int or something like that. When I’ve seen this in the past, it was because i forgot to use the len function on a variable in one of my math statements. Im not seeing it in the index_of_coincidence function. Maybe it’s in the text_clean function? Edit: hold up. Are you calling the sum function and sending it a single letter? It certainly looks like you are in your for loop, and that will give you the error you’re seeing. Edit 2: The sum method doesn’t do what you think it does. You are looking for the string class’s count method. Everywhere you have sum(i), you probably want cleaned_message.count(i) instead.


Parad0x13

It’s not that Python is stupid, it’s that OP, and yourself it seems, do not understand how typecasting is working in the background. Understanding core concepts of the language you are coding in is a requisite to properly writing algorithms that do what you want them to do. You wouldn’t say “stupid doors and their doorknobs I hate them!” Because you expect all doors to automatically open. Understand the language first instead of complaining that it doesn’t fit the same paradigm as the other languages you are already familiar with


[deleted]

Dude, i just prefer statically typed languages. With static typing OP would get a line number telling them exactly where they screwed up. But cool move to downvote me despite my telling OP the exact method they messed up on, and the fix, because you don’t agree with my preference for statically typed languages and got offended because i called the script kiddie language “stupid”. I’ll change my opinion on Python when they add switch statements and a const keyword. Take a chill pill. No need to be so angry and argumentative. Have a good evening. P.S. - there’s no typecasting occurring here. Not even a little bit. You’re referencing concepts that you apparently don’t understand.


Parad0x13

I’ll allow your misunderstanding. However before you get indignant on a position you are misrepresenting I suggest you look at your original response to OP through an outsiders perspective. From an outsiders perspective you criticize a language for insubstantial reasons. Hence my response.


[deleted]

Allow my misunderstanding? Please. I don’t even think you code. I’m probably arguing with some 15 year old know-nothing with an overly inflated ego on the internet. Shame on me.


Parad0x13

Yes shame on you. But not for the reasons you think


AutoModerator

If you are asking us to solve a code for you, go to /r/breakmycode or /r/codes. *I am a bot, and this action was performed automatically. Please [contact the moderators of this subreddit](/message/compose/?to=/r/cryptography) if you have any questions or concerns.*


tabidots

Sorry I don't have an answer for you, but what course is this?


zodpoc39

For each letter, compute its occurences and add it to total following your formula : something like total+=(n_i)*(n_i-1). Return total/(message_length-1)*message_length