"Programming is not remembering exact words or syntax: it is breaking down a problem, working out how to solve it, and then fixing all the inevitable bugs in your solution." - Tom Scott Sorry, i am amazed by this explanation of what programming is and i think it deserves to be quoted in the future too.
2:08 as a software developer i can confirm that. The most important skill you need is finding the right stackoverflow post that describes your problem the best.
By far the most important part of programming is remembering not to delete that one little bit of code you've left untouched for three years because it somehow manages to remain integral to the entire program despite not being referenced by anything.
And there is a chemist's limerick centered around it as well. A mosquito was heard to complain That a chemist had poisoned his brain The cause of his sorrow Was para-dichloro- diphenyl-trichloroethane
0:29 Actually, in 1908 when the 7-segmented display was invented, cursive was by far the most common way of writing, and in cursive, the top of the four is separated just like in the 7-segmented display. You can actually look up notes from 1904 and you will all see them in cursive, and every time the year is written by hand (not by a stamp) the 4 is separated at the top. So we haven't "gotten used to it" but instead we have drifted away from using cursive. The more you know! And in case you were wondering, I write the top of my fours separated, and that's what got me down this rabbit hole.
I loved that you mentioned that programming is not knowing all the syntax for every library and framework by heart, it's all about problem solving. I often see people being ashamed of looking up the documentation all the time to execute some basic methods but it's not abot memorizing, it's about using the right tools and comign up with good solutions
I took computer science at high school. Our large practical assignment which was supposed to be worth 20% of our grade ended up getting thrown out because of large scale cheating throughout the country. They finnaly realised that not even professionals are expected to figure out an entire project from memory alone and I believe you are now allowed to use google
did you use python? because i used a library called "english-words" that got all of the words, and got the same answer as you. here's my code: import re; from english_words import english_words_lower_set liste = [] for item in list(english_words_lower_set): if not re.search('gkmqvwxz', item): liste.append(item) print(max(liste,key=len))
@@PL73 you can replace the for loop with a list comprehension: liste = [item for item in list(english_words_lower_set) if not re.search(‘gkmqvwxz’, item)]
It depends on the country and language I guess. Here this is the standard writing for four, not like the '4'. And 7 has a dash in the middle of it to clear confusion with 1 which is written with that dit at the top like it's written here.
@@NickJerrison I'm one of the few Americans who write a 7 and z with a line through it. Being an electrical engineer it really clears up my bad hand writing at times :)
@@torb1trick415 Z with a dash on the diagonal line is the standard for Z, the same goes for small q it has a dash trough the vertical line. at least where I live
Dichlorodiphenyltrichloroethane was just fine. "i" and "o" should count: remember your classic "Error"? There's and "o" there no one had ever problems with
Exactly. My microwave has a grill function that is displayed as "G" on a 7 segment display. It's a perfectly legit way to write it. I don't get why Tom thinks it's not a "G".
@@kiwihour333 if remove 's' and add 'g' you get hyperbrachycephaly aswell as phenylacetaldehyde and ultrabrachycephaly. Also if you include hyphens, you get 'three-and-a-halfpenny' which is equal to the longest word anyway (if you include the hyphens as characters).
Just shouting into the void as this is years on since the video was posted: I was playing with some 7-segment displays recently and had this exact problem as I needed to output words that used the forbidden characters. Technically we could print every character (upper and lowercase and a fair bit of punctuation) if we were "flexible" in how the letters looked. Map each bit to a segment and we could represent every character from 1-128. So if you're ever in a position where you needed to communicate with someone using only 7-segment displays but needed to write "wax kumquat in gauze" then it's perhaps a workable solution.
0:56 You display the word "Error" which contains the letter "o". It has it's own unique set of segments that differentiates it from the number "0"; therefore, you incorrectly included "o" in var badLetter.
@@soldierofkazus you think it's a 5 because most things that used numbers use this 7 light display and they used 5 as that even though it looks more like an s just not as curvy
I want to learn computer science and my knowledge for programming is really low, but it makes me so happy that I immediately understood how the code worked and the purpose of each line, if course with extra help of the explanation. Really cool!
Just did this as an exercise in PYTHON using the GERMAN dictionary and adding ä, ü and ö to the badLetters. The longest german word to write on a SEVEN-SEGMENT DISPLAY is "Schnittstellendefinitionssprachen" which translates to interface description languages. Or, if we exclude i and o as well, it would be "Altersstufenentsprechenden".
Tom is great at this. If you want gritty engineering details then Technology Connections will strip a DVD down to its chipset. But if you want to have a little fun while learning something new: Tom is the guy.
Isn't the entire point of being a begginer using things without really understanding how they work? The point is that a begginer can use that code, and edit it, and it should work as they expect. I admit I have no idea what regular expressions are. However, the code shown does not in any way confuse me.
Regexes aren't deep voodoo. Er, unless you make big complicated regexes, in which case you're probably doing something wrong. Good code and readable code have a very high rate of overlap(*), so if a piece of code looks like deep voodoo, it was likely written by someone who wasn't very good at what they were doing. * In terms of Venn diagrams, the circle for "good code" is mostly contained within the circle of "readable code".
@@matek9975 Trust me, when you work in the abuse department of a major webhosting company and have to write regex to filter spam you'll "git good" at regex or die trying. The real regex gods all sit in such departments. Whenever there is a fresh wave being pushed through a number of mailservers which have a 100 Gbps pipe you have to be fast at writing regexes or a) your customers get pissed about too much spam or b) you'll end up being blacklisted by other ISPs. And then you have to deal with limited regex engines that don't allow backreferences etc. And spammers are very creative in bypassing your regexes... so if you want to learn how to use regex in the real world... work at the abuse department of an ISP. :D I hated regexes before that, now I love them :D
I love these videos where you explain pieces of code, step by step. Especially where you reassure coding noobs like myself, that it's more about knowing how to solve problems, than how to memorise actually coding techniques.
Well, no, it is actually extremely important that you learn coding techniques. You absolutely need to know when to use if statements, loops, arrays, objects, etc. etc. The part that he's referring to that you don't NEED to memorize is the exact syntax or keywords, because you can always look those up. But if you can't look at a problem and say "okay I can solve this with a for loop that checks against a regex and pushes to an array, let me just google how Python implements arrays", then you need to study more. Googling your specific problem and just copy-pasting code you don't understand from StackOverflow is not a good solution.
as a CS student half way through his studies (and from personal projects), I can confirm this. :P It is better to find a trivial solution that works, and then improve it from there (ofc, if you can think of the most optimized right off the bat, congrats, implement it).
I thoroughly enjoyed this one. You made me remember why I studied programming more than 30 years ago ... even though I never used my knowledge, it still gives me a thrill. Thanks
That brief bit about coding being more of a large problem instead of a bunch of lines and remembering in the beginning was really good. Genuinely made me look at it completely differently to how I did before and I am gonna try and get into it
Bonus content: Here's the code I used to find this list: var fs = require('fs'); var words = fs.readFileSync('words.txt').toString().split(' '); var badLetters = /[gkmqvwxzio]/; words = words.sort((a, b) => b.length - a.length); words = words.filter(a => !a.match(badLetters)); console.log(words.slice(0, 100).join(' '));
Canadian, and we write it like it is on the 7-segment display. I've never seen it drawn with an angle like it is in fonts. Actually I think it might be a generational thing. Those who grew up with the idea of having a clock radio by their bed. Though we even wrote 4s like that in school and I'm not sure our teachers were that young.
In my school days, I used to write 4 like an angled little L with additional vertical stroke passing through the middle of horizontal stroke of L. My friends used to write it as in inverted h (or like 7 stroke display). Currently I write it as it is printed. I'm from India.
his reasoning seems weirdly inconsistent to me, lowercase o doesn't look similar to any number, while S is 5 as you said. Also that capital G without the crossbar seemed quite clear, and a 9 and q are clear since the bottom segment is off with the q.
Dropping o also doesn't make sense as usually 0 and o are displayed differently in seven segment displays. o is nearly always displayed with only the bottom 4 lines making a small o compared to the taller 0.
The original question was, "what is the longest word". Since words are made of letters, you can exclude digits and reuse the 7-segment digits /[015689]/ for letters.
My guess is that a good way to handle multiple words of the same length, is throw any words of equal length (that satisfy the test) into a list, and clear the list if you've found a longer acceptable word
Yes, this would be the correct approach to this. I actually wrote a piece of code (in Java) with exactly this addition because I was curious to find out if there is any other words that would be valid and of the same length - There aren't, in case you were wondering
This video has unexpectedly opened my mind to more reasons why I should program more. I've always seen programming to just be something that you make so that you can use it later on such as a common one, the calculator or maybe things like bots or websites. But no, programming can just be used for solving ANY problem, no matter how many times it needs to be solved or how complicated the problem is. So if I ever do wonder about something weird like this, maybe I'll use programming again.
(01:10) _“What is the longest word one may write on a seven-segment display?“_ Either of the words _A_ or _I._ Maybe _O,_ depending on semantic permissiveness. You said _a_ seven-segment display. Singular. I win!
Abram Thiessen: Good point. "li" is a word in English though (actually several, derived from various different Mandarin tones). This makes me wonder if there is a phonetically longer Chinese, Japanese or Korean character that can be represented on a 7-segement display?
Good note on Big O notation. What I use as a rule of thumb, if your dataset is smaller than 1000-ish or run less than once every minute, you can probably ignore performance. And if you can't, your prototype will be slow enough that you can find it out before deployment.
Thank you Tom, i really loved what you said about being a programmer and still looking things up, i think it's important to tell people that, you don't have to be able to do everything perfectly out of memory. Thank you for this video!
That start segment with JS was a nice way of telling new people to not be afraid of programming :- ) Googling is 90% of programmer's beginnings until you just know it as muscle memory and it's still more googling because we're human not SSDs.
Not only is 8 bits convenient for storing. When your microcontroller writes to output pins, it will often use ports. Basically, a group of 8 outputs. Each group corresponds to a byte somewhere in memory. It allows you to write all 8 pins in one single clock tick, instead of turning on each individual pin one by one. And you can also make a look-up table with characters that you can display on the display by just writing that one entry directly to the port. A long story short, it makes the whole processing more convenient, not just the storage. Source: I'm an embedded systems engineer (in training)
programming is not just understanding whatever language you learnt, the most important skill you can have as a programmer is understanding things, like the 7-segment display, but those 7 lines can create so much.
0:36 You can actually use 6 straight lines to write numbers (i. e. by making a box with two diagonals), if you're OK with chopping one of them in half (but still having the two halves be connected in the electronics).
It doesn't matter you're still using up one seven segment display whether you write a small n or a big n so it will not affect the question of word length as you cannot alter the number of characters you are using by changing the size of one of those characters. Unless you have some other reason I haven't considered which I cannot imagine you do.
A mosquito was heard to complain That a chemist had poisoned his brain. The cause of his sorrow Was *para*-dichlorodiphenyltrichloroethane CHEMISTRY JOKES
*_ALL_* of the text should have been in a 7-segment display font! Some letters just require creativity, like M divided between 2 displays, or, use the display in the "Speak and Spell" as a font.
As old as this video is the “don’t be afraid to look stuff up” still stands true. From doctors to engineers to students doing homework, if you’re not sure don’t be afraid to ask or look it up.
Also Tom, I would like to give my two cents on the google in programming debate. I've worked as a programmer for 9+ years now (I'm 26) and I've found that everybody uses Google. There is a great example of a guy being confounded by accidentally upvoting himself on stack overflow after finding his own solution to a problem from 3 years prior not actually realising it's his own username. I still code mostly in C with occasional Swift sprinkled in. I remember the olden days, when in my dads office we'd look through endless Reference books and my uncle had shelves full of Linux and Ruby "In a nutshell" guides from O'Reilly. All forgotten eras now. I google stuff daily! It's *the* Reference book of the modern age. Skill is always contemporary. I learned how to analyse opcode at University. I had forgotten everything when it actually came to use it. You can do anything thanks to google. You just need to have the balls and the dedication to break the problem down. The only thing that one needs to address individually is coding style and good practise. Not every solution on the web is created equal. So in my company for example I established a style guide. Based on MISRA. I broke it down to 65 simple rules (some added by me) that are easy to reference, covering things like no gotos, no uninitialised or empty functions, always write catch all routines and where to indent.
> There is a great example of a guy being confounded by accidentally upvoting himself on stack overflow after finding his own solution to a problem from 3 years prior not actually realising it's his own username. Exactly. Hell, I wrote like 5 questions to SO and this already happened to me once... > always write catch all routines and where to indent Blasphemy!
You should always have at least 6 tabs open in your browser whilst programming, One of which should be one of those idle clicker games (when you need to give your brain a five minute break of "subconscious thinking time"), but the rest are API reference pages and Stack Overflow. Also, in your download bar at the bottom of the browser ought to be a couple of ZIPs from a Github project, for source code examples. Anything less than this and, basically, you're doing it wrong.
I'm late to the party but this is the other word that could be extracted (matching tom's regex and dictionary); supertranscendentness & three-and-a-halfpenny
im also late but i got the same result. here's my code var fs = require("fs") var words = fs.readFileSync("words.txt").toString().replace(" ","").split(" "); var rec = 0; var accept = []; var badwords = /[gkmqvwxzio]/; for (var test of words) { if (test.length < rec) {continue;} if (test.match(badwords)) {continue;} if (test.length == rec) {accept.push(test);} if (test.length > rec) {var accept = [];accept.push(test);var rec = test.length} } console.log(rec) for (v of accept) { console.log(v); }
@@elgatitokawai55 The english dictionary recognises it as a word. Some other words also use dashes. It’s a full word. +(The english dictionary cannot be fair or unfair.)
Käpt'n Kadaver Aw thanks for that correction! If it weren’t for your kindness, my dumbass would still be pronouncing it ‘dichlorodiphenyltrichloroethane’ and embarrassing myself! 😊
(If anyone is actually wondering the pronunciation, you basically just have to know where to separate the roots. Di-chloro-di-pheynol-tri-chloro-ethane Which is read like: Die klor-ro die fee-nal try klor-ro eth-ain
China here. Some traffic light have a time display showing how many seconds left till the light changes (ps. they are 2 digits in the display), and in very rare cases, for 100+ seconds, the tens digit start to display letters (A=10x, b=11x, C=12x, etc). And I witnessed a really rare case in a really weird traffic condition. It went up to O (24x). I forgot how they dealt with K (shame). But since all they have to do is to make every letter distinguishable from other ones (drivers can see a strange shape, and think either it's 100+ or the light is broken), for the tricky letters: G - yeah they just did the 6 without the bit in the middle. I - to tell it from number 1, it used the two lines on the left of the display while the number used the two on the right. M and N - M is a big arch (0 without the bottom), N is a small arch. O - to tell it apart from number 0, the letter O uses the small square. Sadly this scene never, ever, ever happened in my life again.
Of course,I'm taking notes of every new thing I'm learning in C++ and writing down every new syntax I come across,which I'll memorise through practice and repetition,I'm not a complete amateur.
@RadGH Even Not gonna deny,I do have low self esteem,but I'm advancing quickly,and I believe I'll be able to call myself a programmer one day,I appreciate the advice though.
This would be easier in bash with grep, awk and sort. It is a one-liner and you can also get a list not just the longest: grep -v '[gkmqvwxz]' < words.txt | awk '{ print length, $0 }' | sort -n | tail -n 5 Change the -n 5 at the end if you don't want the 5 longest and replace the 5 with the number you want. Or remove the | tail -n 5 completely to just get a list of all matching words sorted by length
The problem here is that doing that would take way too long. Imagine the IO for printf()ing that many words, plus there’s piping, and insertion/deletion. It would probably be better to whit up some C to delimit the file, then use pointers to re-order everything.
@@thomaspearson9566 It could be optimized a bit by skipping short words, e.g. by setting a minimum word length (7?) in the grep expression and making the awk expression skip words shorter than the longest encountered so far. These changes would vastly reduce the number of lines to be sorted.
@@thomaspearson9566 I've always found Linux pipes to be surprisingly efficient. The grep|awk|sort|tail solution runs in about 0.3 seconds on my machine.
THANK YOU!!! I hate when people think I just know how to fix any problem right off the bat, I have to look stuff up all the time, even things I have done many times in the past. Then, there's..."shutters"...Regex.
Regex is fun! It's like a word puzzle and a math puzzle all in one. As long as you don't expect yourself to remember all the rules without a cheat sheet in front of you, it's fine.
The longest word in the file is pneumonoultramicroscopicsilicovolcanoconiosis, 45 letters. In bash shell grep -i -v -e '[gkmqvwxz]' words.txt | awk '{ print length, $0 }' | sort -n returns 31 dichlorodiphenyltrichloroethane as the last line (that's 31 characters). Add io ([gkmqvwxzio]) and three-and-a-halfpenny is tied with supertranscendentness, both 21 characters. If you add s, considering it looks exactly like 5, then supertranscendentness is lost, and you're left with just three-and-a-halfpenny.
three-and-a-halfpenny is a great word. It's stuff like this that bash is great for. I made a little web scraper using it once that scraped the text off people's LiveJournal pages. only needed a few commands.
Fun fact: there is a game called epistory where you're given words to type to attack enemies. Usually they're 3-10 letter words, but will get up to 16-ish once in a while. However, there's one monster nest where you suddenly get "pneumonoultramicroscopicsilicovolcanoconiosis" as the 'boss' fight. Try typing that one out correctly before the enemy get too close and kills you.
Bonus question: what's the longest word you can spell just by turning a calculator upside-down?
Boobies??
How many digits?
Boobies depending in the length of the calculator.
Edit: also how the hell did a reply to a comment get 447 likes in a month
Oliebol
boobless
Tom: I and O are numbers with aspirations
S: *sweats nervously*
Right? That what I was thinking 😂
this is confusing
@@universenerdd An S in the 8 line format is the same as a 5
3
KSG ICON 😳😳
"Programming is not remembering exact words or syntax: it is breaking down a problem, working out how to solve it, and then fixing all the inevitable bugs in your solution."
- Tom Scott
Sorry, i am amazed by this explanation of what programming is and i think it deserves to be quoted in the future too.
True. As someone who've only recently started getting into programming, I sure find it encouraging.
Also, a lot of people think you need to be good at math to be a programmer, which is not true.
@@Pedro-fh9ec Math and programming have 1 main thing in common - problem solving.
This is very true. Remembering Syntax is not as important as people think. It’s all about solving problems.
And I do NOT miss the old times when I start coding and we had to figure things alone.
2:08 as a software developer i can confirm that. The most important skill you need is finding the right stackoverflow post that describes your problem the best.
I mean... you're not wrong
stop giving away our secrets XD
hey those are industry secrets you're giving away here
Amen.
Or proceed to ask it and defend it against close votes that people voted, apparently without looking.
I was hoping Tom would show us the word displayed in Seven-Segment Displays.
Right, that was a missed opportunity
Same
Probably didn't have a display long enough to show it. 🤷♂
@@destroy_television 🤦♂️ there is a font for seven segment displays to display it on any screen.
how about 'helper'?
I would like it if the display said "Aarrgh" instead of "Error".
I've seen FAIL used before.
But would you prefer "Aarrgh" or "Aarrghh"?
There has been a AARRGH in the system
0 / 0 = Aarrgh
@@renakunisaki My cable box displayed FAIL a few seconds before displaying BOOT before rebooting!
How you gonna do this video and not show "supertranscendentness" on a seven-segment display?!
this is why the awnser is unsatisfying
@@coppertones7093 Also because S is the same seven-segment symbol as 5. S should be excluded for the same reason that g, q, i and o were excluded.
Shawn Willden well too bad, do the code yourself
@@TheDivegeek 4:02
@@Connie_TinuityError hyperbrachycephaly
"Did I know all that code off my heart? No, of course not - I Googled..."
Giving away our dirty secrets, I see.
StackOverflow Gang
By the way, Google is better at searching for something on StackOverflow than StackOverflow itself
@@theparrot271 ye
@@theparrot271 same with almost all sites/forums
everyone knows it lad, do not worry.
Tom: "It doesn't matter that the 4 isn't the way most people write it"
Me: "They don't?? I do..."
Only way I know how to do it too.
That's how I was taught to write it some 50 years ago in school...
I got called a pretentious w**ker once because I cross my 7s so that people don't confuse them with my 1s (and I worked in a science job) ☹
@@Loctorak Write better se7ens dweeb
@@Loctorak Luke, write your sevens however makes you happy.
Me: Wants to know what is the longest word with seven-segment display
You: Teaching me how to program
1K+ and no comments? Sehddd
Exactly
aaa
Pay attention, this *will* be on the test
Im not teaching you how to code? What the hell...
By far the most important part of programming is remembering not to delete that one little bit of code you've left untouched for three years because it somehow manages to remain integral to the entire program despite not being referenced by anything.
wanna talk about something?
Did you mean Telesto?
coconut.png
@@sambennett2319 how dare you reference our lord and savior in this manner... this shall not go unpunished
@@charlesblasini2134 nah, 2fortcow.png
In case if you don't know, "Dichlorodiphenyltrichloroethane" is shortly called DDT. The stuff we used to eliminate ants.
And there is a chemist's limerick centered around it as well.
A mosquito was heard to complain
That a chemist had poisoned his brain
The cause of his sorrow
Was para-dichloro-
diphenyl-trichloroethane
@@DeCeddy that is honestly hilarious, madlad was like "this kills bugs, limerick material"
also killed baby eagles i think
And the longer paradichlorodiphenyltrichloroethane should obviously be in the list.
I think it is banned in several parts of the world because of its health effects.
0:29 Actually, in 1908 when the 7-segmented display was invented, cursive was by far the most common way of writing, and in cursive, the top of the four is separated just like in the 7-segmented display. You can actually look up notes from 1904 and you will all see them in cursive, and every time the year is written by hand (not by a stamp) the 4 is separated at the top. So we haven't "gotten used to it" but instead we have drifted away from using cursive. The more you know! And in case you were wondering, I write the top of my fours separated, and that's what got me down this rabbit hole.
I always write my 4 like that.
I write my fours like this, and my cursive is decent. Got taught it and I'm never going back; it's like my ideas just flow onto the page!
I love how "a", "aa", and "aaa" are all official English language words
Aaa? Aaa aaa aaa aaa aaa aaa 'aaa' aaa aaa aaa aaa aaa aaa aaa aaa. Aaa aaa aaa, 'aaa' aaa aaa aaa aaa aaa aaa aaa, aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa.
They describe the level of something, like AA batteries or AAA baseball
aa
Aaa
*AAAAAAAAAAAAAAAAAAA*
There are no official English language words.
ok boomer
Supertranscendentness seems like a perfectly satisfying answer to the question though
I don't think it is a word many people have ever used
✴️
@@andrewmurphy5310 But its not some weird medicinal term either, and it is fitting, supertranceding all other words on the list.
Can I just ask how do you make letter T there
@@AlFredry Lower case t in seven segments = both left and lower two centre segs on, the rest off
I loved that you mentioned that programming is not knowing all the syntax for every library and framework by heart, it's all about problem solving. I often see people being ashamed of looking up the documentation all the time to execute some basic methods but it's not abot memorizing, it's about using the right tools and comign up with good solutions
Amen to this!
I took computer science at high school. Our large practical assignment which was supposed to be worth 20% of our grade ended up getting thrown out because of large scale cheating throughout the country. They finnaly realised that not even professionals are expected to figure out an entire project from memory alone and I believe you are now allowed to use google
@@vincento_squishI'd love to know. What country is that
Programing is w3school & stackOverFlow, prove me wrong.
@@indopak_ web programming u mean?
G is not allowed because it looks like a 9, but S is totally fine even though it's exactly the same as a 5. arbitrary rules are arbitrary.
Ding!
+1
Like a 9?
q doesn't even look like a 9
G (6) should have been allowed for mathematical consistency (1, 5, 6, 0) all letters that are alphanumeric in appearance
@@iamillasfuck not to mention, words don't have integers in them, thus, no confusion between letters and integers will occur anyhow.
And you blue-ball us by not showing the word written out using a seven-segment displays...
FIX IT NOW, TOM!
Clickbait
grassy climer Do you expect me to actually do something myself? I came here to enjoy myself and not do work!!!
jk ;) That's a really cool font
Its a video for the sake of uploading something. What do you expect ?
Since it seems URLs may be blocked, add Ng22qYR after the Imgur URL to see what it looks like.
I ran through the linuxwords list and I'm happy to include g - my result was "electroencephalography" which is quite a satisfying answer!
did you use python? because i used a library called "english-words" that got all of the words, and got the same answer as you.
here's my code:
import re; from english_words import english_words_lower_set
liste = []
for item in list(english_words_lower_set):
if not re.search('gkmqvwxz', item):
liste.append(item)
print(max(liste,key=len))
@@PL73 No, just some regex in Vim over the Linux words list. That Python library probably uses the same list!
Thank you for doing it the correct way for us!
@@PL73 you can replace the for loop with a list comprehension:
liste = [item for item in list(english_words_lower_set) if not re.search(‘gkmqvwxz’, item)]
If you're allowing 'g', then the longest is 'greatgreatgreatgreat[...]greatgrandfather'.
q is out cause it looks like a 9. **five seconds later** S is alright.
thought that was dumb the 9 in calculators looks different too
S looks like a 5
@Oliver T. yes
@@YellowToad you don’t say
@@YellowToad ok sherlock
“What’s the longest word you can write on a 7 digit display?”
Me an intellectual: hehe boobies hehe
Me a superior intellectual: Boobieless
@@ItsDavieman me an overlord: boobiesboobiesboobies
It's not seven digits, it's seven SEGMENTS. There are seven available line segments to create a number/letter
@@obiequack4490 yea sorry I missed that
pootis
>not how most people write a four
*Aggressive confusion*
I write fours like that, but typically with lines protruding out a bit. I don't write it like 4.
It depends on the country and language I guess. Here this is the standard writing for four, not like the '4'. And 7 has a dash in the middle of it to clear confusion with 1 which is written with that dit at the top like it's written here.
@@NickJerrison I'm one of the few Americans who write a 7 and z with a line through it. Being an electrical engineer it really clears up my bad hand writing at times :)
Will Pereira z with a line through it? i havent ever seen such madness
@@torb1trick415 Z with a dash on the diagonal line is the standard for Z, the same goes for small q it has a dash trough the vertical line. at least where I live
Dichlorodiphenyltrichloroethane was just fine. "i" and "o" should count: remember your classic "Error"? There's and "o" there no one had ever problems with
Y
@@dustikelly6730 y
Is that a name of a rocket fuel?
@@typicalfish1116
Looks like some sort of plastic.
(thought it'll also work as rocket fuel)
toxic, was used as an insecticide... until more than the insects started dying.
I think the "C with aspirations" makes a solid G, and if I and O are removed then S has to be too.
If you remove S and add back in G "hyperbrachycephaly" is your new longest word
@@kiwihour333 If you remove S and *don't* add back in G 'hyperbrachycephaly' is still your new longest word.
Exactly. My microwave has a grill function that is displayed as "G" on a 7 segment display. It's a perfectly legit way to write it. I don't get why Tom thinks it's not a "G".
@@kiwihour333 if remove 's' and add 'g' you get hyperbrachycephaly aswell as phenylacetaldehyde and ultrabrachycephaly. Also if you include hyphens, you get 'three-and-a-halfpenny' which is equal to the longest word anyway (if you include the hyphens as characters).
Lowercase i and o are fine, completely unambiguous. S is definitely not.
Just shouting into the void as this is years on since the video was posted: I was playing with some 7-segment displays recently and had this exact problem as I needed to output words that used the forbidden characters. Technically we could print every character (upper and lowercase and a fair bit of punctuation) if we were "flexible" in how the letters looked. Map each bit to a segment and we could represent every character from 1-128. So if you're ever in a position where you needed to communicate with someone using only 7-segment displays but needed to write "wax kumquat in gauze" then it's perhaps a workable solution.
I will definitely report back if I'm ever in that position
me, using 16 segments, maybe dot matrix: hehe i dont have your pesky 7-segment issues B)
Gotta say... I'm deeply disappointed that you didn't display the solution in 7-segment characters...
Nethertheless, gr8 work
0:56 You display the word "Error" which contains the letter "o". It has it's own unique set of segments that differentiates it from the number "0"; therefore, you incorrectly included "o" in var badLetter.
DEO also S is just a 5, so that should have been excluded
I
o is not included in var badletters
@@YakobMakel it is. Look here - 8:06
As well as n and u being easily depicted with 3 segments
I and o should count. Written as half height they are not mistaken as 1 and 0
How exactly does S count again? It's literally just a 5...
I does count
@@soldierofkazus you think it's a 5 because most things that used numbers use this 7 light display and they used 5 as that even though it looks more like an s just not as curvy
fenafeses But a G is disallowed for looking the same as a 6
@@WhereWeRoll because in 6, the line connects back at the line but in G it doesn't
I’ve only just found this channel and Tom answers questions I was never gonna have but will always be happy as hell to have learned
Som Tcott
Those "aarrgh"s are valid in Scrabble, for what it's worth.
Both are wrong!!
Completing "aarrghh" after someone spelled "aarrgh" is a powermove.
There are sorts of questionable words that are _allowed in scrabble._
The good old Buchstaben-YOLO.
Only in the pirate version of Scrabble, though.
"It's not a G, it's a C with aspirations"
So in other words, it's a \kʰ\?
(Linguistics joke)
@@Superb17C nice.
@@Superb17C lmao
@@Superb17C no? it's a /c
ʰ/. Or a /sʰiː/ I guess.
@@Superb17C as a mathematician, I see K to the power of h
I want to learn computer science and my knowledge for programming is really low, but it makes me so happy that I immediately understood how the code worked and the purpose of each line, if course with extra help of the explanation. Really cool!
3:47
Seven Segment Display: *displays goal*
People: Oh, 6OAL!
You mean 60AL?
60Д1_
"Oh, 60AL!"
60 all
6041-
I love how he's constantly trying to justify and shield himself from elitist programers
How do you mean?
“elitist”
tbf those fuckers are scary
he's intentionally making himself seem less experienced so that actual beginners find the video more approachable.
Was it intentional that nearly every letter has a similar form in seven segment formatting?
"Can I borrow your Mega Processor?"
"Ha, noooo."
*"I'm Tom Scott."*
[notices red shirt]
"Ok, but be sure and mention us a few times in your video."
Never knew Tom would be more approachable for beginners than Stack Overflow 👍
I actually write my fours the way that seven segment displays show them.
@Érik I always wrote them like that, I always found the other way weird!
Same!
Everyone who does that is a proper wrongin
@@Green-pn7kq Same!!!!
@@ilikemen2736 ok i like men27
Just did this as an exercise in PYTHON using the GERMAN dictionary and adding ä, ü and ö to the badLetters. The longest german word to write on a SEVEN-SEGMENT DISPLAY is "Schnittstellendefinitionssprachen" which translates to interface description languages. Or, if we exclude i and o as well, it would be "Altersstufenentsprechenden".
*"OH LOOK IT'S SIX OAL"*
*"OH LOOK IT'S SIXTY AL"*
When I see 6LACK, I keep thinking SIX LACK instead of BLACK.
GixQine
*OH LOOK IT'S SIXTY NINE*
Fun fact: AARGH is a valid word in Wordle. Go ahead, try it out.
what I can’t believe it actually worked
Ok but wordle doesn’t mean it’s right 😂
Really? And WHY
I wanted to see that word on a 7 segment display.
same
N word?
I love this series.
Real Engineering love your channel
Not verified!
Tom is great at this. If you want gritty engineering details then Technology Connections will strip a DVD down to its chipset. But if you want to have a little fun while learning something new: Tom is the guy.
what are you doing here 😂😂
Jebediah Kerman its him....
> teach programming concepts so beginners understand
> regular expressions
choose one
lmao
You never get good at regex. It's regex gods who decide when you are worthy
Isn't the entire point of being a begginer using things without really understanding how they work? The point is that a begginer can use that code, and edit it, and it should work as they expect. I admit I have no idea what regular expressions are. However, the code shown does not in any way confuse me.
Regexes aren't deep voodoo. Er, unless you make big complicated regexes, in which case you're probably doing something wrong. Good code and readable code have a very high rate of overlap(*), so if a piece of code looks like deep voodoo, it was likely written by someone who wasn't very good at what they were doing.
* In terms of Venn diagrams, the circle for "good code" is mostly contained within the circle of "readable code".
@@matek9975 Trust me, when you work in the abuse department of a major webhosting company and have to write regex to filter spam you'll "git good" at regex or die trying. The real regex gods all sit in such departments. Whenever there is a fresh wave being pushed through a number of mailservers which have a 100 Gbps pipe you have to be fast at writing regexes or a) your customers get pissed about too much spam or b) you'll end up being blacklisted by other ISPs. And then you have to deal with limited regex engines that don't allow backreferences etc. And spammers are very creative in bypassing your regexes... so if you want to learn how to use regex in the real world... work at the abuse department of an ISP. :D I hated regexes before that, now I love them :D
I love these videos where you explain pieces of code, step by step. Especially where you reassure coding noobs like myself, that it's more about knowing how to solve problems, than how to memorise actually coding techniques.
Well, no, it is actually extremely important that you learn coding techniques. You absolutely need to know when to use if statements, loops, arrays, objects, etc. etc. The part that he's referring to that you don't NEED to memorize is the exact syntax or keywords, because you can always look those up. But if you can't look at a problem and say "okay I can solve this with a for loop that checks against a regex and pushes to an array, let me just google how Python implements arrays", then you need to study more. Googling your specific problem and just copy-pasting code you don't understand from StackOverflow is not a good solution.
0:30 what do you mean most people don't write 4 like that? I've always written 4 like that.
For real. I'm so confused by that.
4
Maybe it's a UK/us thing?
Same for me.
Usually vertical an horizontal line cross
@7:05 "but I reckon for things like this it's fine"
All of software development in a nutshell.
Randall Stephens my internship in a nutshell
Randall Stephens That’s life in a nutshell
as a CS student half way through his studies (and from personal projects), I can confirm this. :P It is better to find a trivial solution that works, and then improve it from there (ofc, if you can think of the most optimized right off the bat, congrats, implement it).
HP hardware design team: why not build alphanumeric LED displays
I‘ll refactor that later 🙃
Tom: What is the longest word you can make in 7 segments?
Me: Boobies?
_Boooooooooooooooooooooooooooooooooooobies_
No-one:
Calculator during maths:
8008135
actually 5318008
I figured outhow to spell shell oil on a calculator in school. Oh I was so proud.
@DispelTheMyth but it's less funny
I thoroughly enjoyed this one. You made me remember why I studied programming more than 30 years ago ... even though I never used my knowledge, it still gives me a thrill. Thanks
Tom Scott: the unofficial Vsause 4
so true
Arrête, nazi
this comment has 444 likes, 4 comments and has the number 4 in it
@@Rissoe_Really Your comment has 4 likes.
Ahh, the classic "leave it to the reader as an exercise".
>writes code and shoots video
>sends to editor
>"what happens if there's multiple correct answers tom?"
>"aarrghh"
The bonus upside down calculator question gives a much more satisfying answer:
bibliologies glossologies
531607055016
531607017818
And it's relevant too!
Or if you don't include 'g', it's hillbillies
Genius!
Calculator writing is behglios
Try typing in 7134-9315
2:10 thank you for this little tid bit of advice. It genuinely changed how I feel about myself and my progress and made me feel better tbh. Thank you
Such a missed opportunity to show the final words using 7-segmwnts displays. That why I was watching the whole video for. Im gutted!
Same....
codepen io has a version of it
@@LambentLight00 codepen io has a version of it
The question: "What is the longest word you can write on a seven-segment display"?
The answer: A
You only gave me a single seven-segment display.
Bruh
Or 65535, the max value of the WORD datatype.
You can’t write an A on a seven segment display, it would have to be I instead
@@rat.tar.tar.8359 You can write A on a seven segement display
@@rat.tar.tar.8359
_
|_|
| |
This is an "A", isn't it?
I think the logic for ruling out "G" (because the number 6 already uses it) should also rule out "S" (because the number 5 already uses it).
At least the 'S' is structurally accurate. The 6 loops back and actually touches the left line. The brain just struggles to accept that as a G.
great then do it yourself
@@mikepictor in that case, lower case g is spot on.
Yes, but I think the 'G' that doesn't connect like a 6 is very readable, and a lowercase g is also readable.
@David: not really, lowercase g goes partially bellow the line. Its 7-segment version doesn't, making it look more like 9 than g.
S is a 5 so you should put it in the variable “badLetters”
Then it would just be "badletter" :(
Lowercase I and O exist (no dot needed for i)
That brief bit about coding being more of a large problem instead of a bunch of lines and remembering in the beginning was really good. Genuinely made me look at it completely differently to how I did before and I am gonna try and get into it
"if you don't like it, fix it in your version"
Here's the longest hundred words that you can write with seven-segment displays:
(note, supertranscendentness is actually the only one of that length.)
supertranscendentness
supersuperabundantly
superrespectableness
unapprehendableness
supertranscendently
supersuperabundance
untranslatableness
untranscendentally
unsupernaturalness
ultrabrachycephaly
hyperbrachycephaly
phenylacetaldehyde
supersuperabundant
understandableness
superadaptableness
subtransparentness
unattractableness
unadulteratedness
preternaturalness
unrepresentedness
characterlessness
unpreternaturally
unpresentableness
unprecedentedness
unpersuadableness
leadenheartedness
hypertranscendent
feebleheartedness
pentadecahydrated
hyperbrachycephal
hyperaccurateness
blunderheadedness
tenderheartedness
supertranscendent
untransparentness
structurelessness
superaccurateness
superabstractness
unsurpassableness
unassessableness
unascendableness
schlauraffenland
unrebuttableness
unappeasableness
unappealableness
unacceptableness
unabstractedness
unpreferableness
unparalleledness
beetleheadedness
hypersensualness
transplacentally
hypernaturalness
translatableness
transferableness
transcendentness
transcendentally
platystencephaly
archpresbyterate
falseheartedness
hypercarburetted
pentadecahydrate
pentaphylacaceae
ununderstandably
ununderstandable
untranscendental
untenantableness
unsuspectfulness
unsupernaturally
naphthanthracene
undetestableness
unsufferableness
unsuccessfulness
underspurleather
underrepresented
bulletheadedness
undependableness
undepartableness
undefendableness
undefeatableness
supersulphureted
superrespectably
superrespectable
supernaturalness
preterpluperfect
dunderheadedness
stucturelessness
subbrachycephaly
unsearchableness
supercapableness
superblessedness
sunnyheartedness
uncensurableness
uncalculatedness
uncalculableness
unbreathableness
unbreachableness
unreturnableness
unrespectfulness
subtransparently
Bonus content: Here's the code I used to find this list:
var fs = require('fs');
var words = fs.readFileSync('words.txt').toString().split('
');
var badLetters = /[gkmqvwxzio]/;
words = words.sort((a, b) => b.length - a.length);
words = words.filter(a => !a.match(badLetters));
console.log(words.slice(0, 100).join('
'));
@@FC-mv4hy Clever!
Just getting into coding and stuff (how do you call it?), and the more I see the more I love it.
Personally, I'd probably disallow the ones that double up the "super", but that could just be an example of my blunderheadedness.
Cadwaladr If we’re going to keep adding rules like this, it’s going to be the same complexity as taking into account time zones.
Supersuperabundantly
Tom taught me more about programming in this one video than my IT teacher has in 3 years
But that is how I write a 4
ah, not on youtube apparently, you liar
I'm from Europe and we write it "opened"
Same, I've always written it this way. Maybe it depends on which country you're from?
Canadian, and we write it like it is on the 7-segment display. I've never seen it drawn with an angle like it is in fonts. Actually I think it might be a generational thing. Those who grew up with the idea of having a clock radio by their bed. Though we even wrote 4s like that in school and I'm not sure our teachers were that young.
In my school days, I used to write 4 like an angled little L with additional vertical stroke passing through the middle of horizontal stroke of L.
My friends used to write it as in inverted h (or like 7 stroke display).
Currently I write it as it is printed. I'm from India.
Eh. A lowercase "o" should be fine, it's not duplicating the 0 in shape.
If you are dropping ‘i’ and ‘o’ as they are numbers 1 and 0 also need to drop ‘s’ as it is 5
Also z is 2
his reasoning seems weirdly inconsistent to me, lowercase o doesn't look similar to any number, while S is 5 as you said. Also that capital G without the crossbar seemed quite clear, and a 9 and q are clear since the bottom segment is off with the q.
Dropping o also doesn't make sense as usually 0 and o are displayed differently in seven segment displays. o is nearly always displayed with only the bottom 4 lines making a small o compared to the taller 0.
The original question was, "what is the longest word". Since words are made of letters, you can exclude digits and reuse the 7-segment digits /[015689]/ for letters.
My guess is that a good way to handle multiple words of the same length, is throw any words of equal length (that satisfy the test) into a list, and clear the list if you've found a longer acceptable word
Based on my limited programming experience, I think that'll work well.
Yes, this would be the correct approach to this. I actually wrote a piece of code (in Java) with exactly this addition because I was curious to find out if there is any other words that would be valid and of the same length - There aren't, in case you were wondering
8:02 "I'm gonna rule out I and O, they're just numbers with aspirations...." but, the S looks exactly like a 5, why didn't you rule that out too?
That was a stupid choice.
@@capitaopacoca8454 agreed.
Wow
@@capitaopacoca8454 . You could write some code yourself.
@@OP-1000 I write.
"Don't be afraid to look stuff up" I wish someone told me this a few years sooner
This video has unexpectedly opened my mind to more reasons why I should program more. I've always seen programming to just be something that you make so that you can use it later on such as a common one, the calculator or maybe things like bots or websites. But no, programming can just be used for solving ANY problem, no matter how many times it needs to be solved or how complicated the problem is. So if I ever do wonder about something weird like this, maybe I'll use programming again.
(01:10) _“What is the longest word one may write on a seven-segment display?“_
Either of the words _A_ or _I._ Maybe _O,_ depending on semantic permissiveness.
You said _a_ seven-segment display. Singular. I win!
I saw you in Dublin Airport today getting stuck in security. I wanted to say hi but airports are stressful enough. Hi!
username checks out, wrong person tho
Should have just waved wildly and grinned like a maniac, definitely not-stress-inducing at worst, and amusing at best.
Maybe you could show us how it looks like on a seven segment display
Yeah, that would be nice
*what* it looks like* goddammit!
Don't you think DDT is too long for a 7-segment display? Yes it is
@@aurelia8028 How are you so upset about?
@@aurelia8028 how it looks like. What it looks like. How do you mean. What do you mean.
English vs american
"I" is the answer!
(At 1:05 Tom says "...with a 7-segment display" thus only allowing one display!)
"A" equals it.
I would argue that "A" is longer than "I" because "I" doesn't use the left side of the display and is therefore less physically long.
I would say the french word "il" can be shown with a single 7 segment display. Though that isn't english, it is a word.
RoCeb: That interpretion alternative of "longest" is why I choose "I"!
Abram Thiessen: Good point. "li" is a word in English though (actually several, derived from various different Mandarin tones). This makes me wonder if there is a phonetically longer Chinese, Japanese or Korean character that can be represented on a 7-segement display?
Good note on Big O notation. What I use as a rule of thumb, if your dataset is smaller than 1000-ish or run less than once every minute, you can probably ignore performance. And if you can't, your prototype will be slow enough that you can find it out before deployment.
“No ones gonna look at it and see 6OAL”
Me, whos been half listening and just glanced at it: 6oal???
isn't there a letter in the cyrillic script that looks like a 6 though?
Edit: yup, б
@@dominikbylina9957 Б
I saw "60 AL" there.
Memento Mori
Memento Mori
So I and O are "numbers with aspirations", but S (just a 5) is fine?
I think G, l, O, Q, Z should be allowed as well
If you replace the corners in 5 with curves you get an S so S is fine but if you do it with O it is also fine
What?
How would you do a Q?
how could you do Q?
@@carter22j it would be a 9
@@onionbot2 the same way i do P, but mirrored. It would not be a 9, because 9 has an extra bar on the bottom.
something is missing,
you didn't show us that "supertranscendentness" in seven segment types
Thank you Tom, i really loved what you said about being a programmer and still looking things up, i think it's important to tell people that, you don't have to be able to do everything perfectly out of memory.
Thank you for this video!
That start segment with JS was a nice way of telling new people to not be afraid of programming :- )
Googling is 90% of programmer's beginnings until you just know it as muscle memory and it's still more googling because we're human not SSDs.
Not only is 8 bits convenient for storing. When your microcontroller writes to output pins, it will often use ports. Basically, a group of 8 outputs. Each group corresponds to a byte somewhere in memory. It allows you to write all 8 pins in one single clock tick, instead of turning on each individual pin one by one. And you can also make a look-up table with characters that you can display on the display by just writing that one entry directly to the port. A long story short, it makes the whole processing more convenient, not just the storage.
Source: I'm an embedded systems engineer (in training)
I am taking a computer architecture course at the moment. A little "lower level" than I would personally prefer, but interesting nonetheless.
3:39 Tom, Tom... the letter G itself is just a letter C with aspirations. *Met* aspirations, but aspirations all the same.
And yes, I'd love to see you cover Big O notation.
no, it's the letter c but voiced. the letter c but aspirated would be ch (χ)
@Formor Immington -- you got me there. 😆
@@f0rm0r you mean "k" I don't what this "c" is, but it sounds like Raditz.
And the *K* would be *├*
programming is not just understanding whatever language you learnt, the most important skill you can have as a programmer is understanding things, like the 7-segment display, but those 7 lines can create so much.
Clocks, supermarket checkouts, calculators, slot machines...
You forgot automobile-based time machines.
Seven-segment displays? Where we're going, we don't need seven-segment displays!
Buuut, for month display, they used 16-segment displays. Like, for NOV or OCT
Never nix something for being aspirational. Those letters will one day come back to haunt the numbers that surpassed them.
‘Boobless’ was the old favourite that used as many segments on a standard calculator.
i remember it as 6922251 * 8
I find it hard to imagine "boobless" being the favourite of anything.
@@Loctorak I see you have yet to be introduced to the "flat is justice" brotherhood
@@gairisiuil For structuring the joke around it it was usually made as 6922251 * 2 * 2 * 2. Same thing obviously, but different...
0:36 You can actually use 6 straight lines to write numbers (i. e. by making a box with two diagonals), if you're OK with chopping one of them in half (but still having the two halves be connected in the electronics).
Wait, why does the “n” have to be full height?
@real gamer why not to write it half the height though?
@@88Timur88Bahmudov88 you could but that just isn't the way it is
as same as "c"
Why does it matter?
It doesn't matter you're still using up one seven segment display whether you write a small n or a big n so it will not affect the question of word length as you cannot alter the number of characters you are using by changing the size of one of those characters. Unless you have some other reason I haven't considered which I cannot imagine you do.
A mosquito was heard to complain
That a chemist had poisoned his brain.
The cause of his sorrow
Was *para*-dichlorodiphenyltrichloroethane
CHEMISTRY JOKES
Nice! it even fits the rhythm!
A limerick has to have two lines in B rhyme. Not one. E.g.
The cause of his sorrow,
as seen on the morrow,
was para-dichlorodiphenyltrichloroethane.
Akshay Anand there's a linebreak after chloro
@@feralcatgirl not exactly rhyming though. You pronounce the syllable for -chloro and sorrow differently.
that depends on your accent/dialect
Wasted opportunity to not show the word in seven-segment fonts
*_ALL_* of the text should have been in a 7-segment display font! Some letters just require creativity, like M divided between 2 displays, or, use the display in the "Speak and Spell" as a font.
As old as this video is the “don’t be afraid to look stuff up” still stands true. From doctors to engineers to students doing homework, if you’re not sure don’t be afraid to ask or look it up.
Also Tom, I would like to give my two cents on the google in programming debate. I've worked as a programmer for 9+ years now (I'm 26) and I've found that everybody uses Google. There is a great example of a guy being confounded by accidentally upvoting himself on stack overflow after finding his own solution to a problem from 3 years prior not actually realising it's his own username.
I still code mostly in C with occasional Swift sprinkled in. I remember the olden days, when in my dads office we'd look through endless Reference books and my uncle had shelves full of Linux and Ruby "In a nutshell" guides from O'Reilly. All forgotten eras now. I google stuff daily! It's *the* Reference book of the modern age. Skill is always contemporary. I learned how to analyse opcode at University. I had forgotten everything when it actually came to use it. You can do anything thanks to google. You just need to have the balls and the dedication to break the problem down.
The only thing that one needs to address individually is coding style and good practise. Not every solution on the web is created equal. So in my company for example I established a style guide. Based on MISRA. I broke it down to 65 simple rules (some added by me) that are easy to reference, covering things like no gotos, no uninitialised or empty functions, always write catch all routines and where to indent.
What about the other 61/62 rules?
> There is a great example of a guy being confounded by accidentally upvoting himself on stack overflow after finding his own solution to a problem from 3 years prior not actually realising it's his own username.
Exactly. Hell, I wrote like 5 questions to SO and this already happened to me once...
> always write catch all routines and where to indent
Blasphemy!
The number of times I've found my own answer to a question on stack overflow helpful is now in double digits :D
Programming is basically 80% knowing how to properly disect and research a problem online.
You should always have at least 6 tabs open in your browser whilst programming, One of which should be one of those idle clicker games (when you need to give your brain a five minute break of "subconscious thinking time"), but the rest are API reference pages and Stack Overflow. Also, in your download bar at the bottom of the browser ought to be a couple of ZIPs from a Github project, for source code examples.
Anything less than this and, basically, you're doing it wrong.
I'm late to the party but this is the other word that could be extracted (matching tom's regex and dictionary);
supertranscendentness & three-and-a-halfpenny
im also late but i got the same result.
here's my code
var fs = require("fs")
var words = fs.readFileSync("words.txt").toString().replace("
","").split("
");
var rec = 0;
var accept = [];
var badwords = /[gkmqvwxzio]/;
for (var test of words) {
if (test.length < rec) {continue;}
if (test.match(badwords)) {continue;}
if (test.length == rec) {accept.push(test);}
if (test.length > rec) {var accept = [];accept.push(test);var rec = test.length}
}
console.log(rec)
for (v of accept) {
console.log(v);
}
The last on is unfair. Those are just 4 words but with dashes, not a full word
@@elgatitokawai55 The english dictionary recognises it as a word. Some other words also use dashes. It’s a full word. +(The english dictionary cannot be fair or unfair.)
oh - is allowed isn't it?
@@elgatitokawai55 is it in the dictionary? then it's allowed
After months of practice I have finally mastered the pronunciation of that word! It is pronounced dichlorodiphenyltrichloroethane!
Sorry, but it's pronounced "dichlorodiphenyltrichloroethane", not "dichlorodiphenyltrichloroethane".
DDT
Skol Vikings Thanks this really helped! 😊
Käpt'n Kadaver Aw thanks for that correction! If it weren’t for your kindness, my dumbass would still be pronouncing it ‘dichlorodiphenyltrichloroethane’ and embarrassing myself! 😊
(If anyone is actually wondering the pronunciation, you basically just have to know where to separate the roots.
Di-chloro-di-pheynol-tri-chloro-ethane
Which is read like:
Die klor-ro die fee-nal try klor-ro eth-ain
Thanks for making me feel a bit better today, i was crying an hour before i watched your video and i subbed
China here. Some traffic light have a time display showing how many seconds left till the light changes (ps. they are 2 digits in the display), and in very rare cases, for 100+ seconds, the tens digit start to display letters (A=10x, b=11x, C=12x, etc).
And I witnessed a really rare case in a really weird traffic condition. It went up to O (24x).
I forgot how they dealt with K (shame). But since all they have to do is to make every letter distinguishable from other ones (drivers can see a strange shape, and think either it's 100+ or the light is broken), for the tricky letters:
G - yeah they just did the 6 without the bit in the middle.
I - to tell it from number 1, it used the two lines on the left of the display while the number used the two on the right.
M and N - M is a big arch (0 without the bottom), N is a small arch.
O - to tell it apart from number 0, the letter O uses the small square.
Sadly this scene never, ever, ever happened in my life again.
Maybe K was |-| and H was a lower case, h ("4" rotated 180deg).
@@HunterDigi Or the opposite could be true. I have also seen this for "k".
|_
|_
K could also be this
_
|_
| |
i is one segment and L is 2, both on left side.
This is also a unique solution for K:
|-
2:10 I'm a self taught programmer in progress and I really needed to hear this.
but you really need to understand the syntax, otherwise you will just continue to look things up, modify it and never actually write your own code.
Of course,I'm taking notes of every new thing I'm learning in C++ and writing down every new syntax I come across,which I'll memorise through practice and repetition,I'm not a complete amateur.
You should also read about "imposter syndrome" which should build up some confidence if you can't convince yourself you are a "real" programmer
We cannot know everything and we learn by looking stuff up 🤙👍
@RadGH Even Not gonna deny,I do have low self esteem,but I'm advancing quickly,and I believe I'll be able to call myself a programmer one day,I appreciate the advice though.
That "C with aspirations" joke is the funniest thing I´ve heard this week.
I appreciate that this is secretly a tutorial on how to get started writing a computer program.
This would be easier in bash with grep, awk and sort. It is a one-liner and you can also get a list not just the longest:
grep -v '[gkmqvwxz]' < words.txt | awk '{ print length, $0 }' | sort -n | tail -n 5
Change the -n 5 at the end if you don't want the 5 longest and replace the 5 with the number you want. Or remove the | tail -n 5 completely to just get a list of all matching words sorted by length
The problem here is that doing that would take way too long. Imagine the IO for printf()ing that many words, plus there’s piping, and insertion/deletion. It would probably be better to whit up some C to delimit the file, then use pointers to re-order everything.
@@thomaspearson9566 It could be optimized a bit by skipping short words, e.g. by setting a minimum word length (7?) in the grep expression and making the awk expression skip words shorter than the longest encountered so far. These changes would vastly reduce the number of lines to be sorted.
@@thomaspearson9566 I've always found Linux pipes to be surprisingly efficient. The grep|awk|sort|tail solution runs in about 0.3 seconds on my machine.
02:00 Thanks for pointing that out. I bet most people think programmers know how to code everything. Google is your best friend when programming
THANK YOU!!! I hate when people think I just know how to fix any problem right off the bat, I have to look stuff up all the time, even things I have done many times in the past.
Then, there's..."shutters"...Regex.
Regex is fun! It's like a word puzzle and a math puzzle all in one. As long as you don't expect yourself to remember all the rules without a cheat sheet in front of you, it's fine.
But but but .... I do know how to code everything.
DoSomeOfIt();
DoMoreOfIt();
DoTheRestOfIt();
is the program for anything.
Nothing wrong with using google while programming but if you do not know how to load a file then you kinda suck at your language
The longest word in the file is pneumonoultramicroscopicsilicovolcanoconiosis, 45 letters. In bash shell grep -i -v -e '[gkmqvwxz]' words.txt | awk '{ print length, $0 }' | sort -n returns 31 dichlorodiphenyltrichloroethane as the last line (that's 31 characters). Add io ([gkmqvwxzio]) and three-and-a-halfpenny is tied with supertranscendentness, both 21 characters. If you add s, considering it looks exactly like 5, then supertranscendentness is lost, and you're left with just three-and-a-halfpenny.
Finally! The best way.
three-and-a-halfpenny is a great word. It's stuff like this that bash is great for. I made a little web scraper using it once that scraped the text off people's LiveJournal pages. only needed a few commands.
three-and-a-halfpenny seems more like a phrase to me. I've never considered words connected by - to be one word before personally.
Fun fact: there is a game called epistory where you're given words to type to attack enemies. Usually they're 3-10 letter words, but will get up to 16-ish once in a while. However, there's one monster nest where you suddenly get "pneumonoultramicroscopicsilicovolcanoconiosis" as the 'boss' fight. Try typing that one out correctly before the enemy get too close and kills you.
‘cyclopentanoperhydrophenanthrenes’ this is the best i have found.