Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
Tahaga7697y@jhh2450 π
Well honnestly I didn't use the dictionnary solution because I don't use python a lot so I didn't think about it, but it's the most efficient one.
I basically created an array with our alphabet and an array with the corresponding characters, converted the string to an array, replaced every char and converted it back to a string, whereas the dictionnary just uses every char of the string as the key to the corresponding char, so you basically just have to scan the string -
@Tahaga Well my thought process is setting a condition for every character is easy. It's repetitive and kinda ugly to read, but it gets the job done. And it's also hard to fuck it up lmao
-
Tahaga7697y@jhh2450 it does work, but for some bigger tasks it would be difficult
(+ I haven't checked it, but I feel like a condition for every character is quite slower)
I think it's better to do it in a way that it would be scalable and easier maintainable, this way you get the good Habits while learning! π -
@Tahaga Oh it's definitely better to not do it. It's incredibly inefficient, but if it meets the requirements for class, fuck it. Lol
Related Rants
-
sonrisa37Best quotes from IT teacher: - "C# is a language to program your IDE." - "C# is a language for beginners, and...
-
PieInOblivion11I once brought my Kali Linux laptop to school. (Because normal had dead battery, waiting for shipping) MFW so...
-
Gerrymandered35I was in school and I got bored. I opened two command prompts and did what any scammer would do. I went to t...
So today at the beginning of the class, our teacher asked us to write a function that translates a given string to "leet speak" (basically having to replace every character to another).
Some used python dictionnaries, some used arrays...
And the two people arround me wrote a program with a condition for EVERY SINGLE CHARACTER.
It kind of made me wanna die or kill them π₯
rant
desperate
school