Dijkstra's algo is pretty easy to code. One of the very first assignments we got in data structures and algorithms course was to code Dijkstra's prime number algorithm in C or Java.
@hlubradio231820 сағат бұрын
Oh lordy lord
@hlubradio231820 сағат бұрын
Nice but noob programming which is a reason that i dont combined multiple conditions like that on my if statements
@givowo20 сағат бұрын
ok but how slow is this really?
@AJBrickhead21 сағат бұрын
How do I move a mouse when I rotate a rotation sensor
@DownloadableFox21 сағат бұрын
If you are worrying about optimization, then you probably shouldn't be using Python.
@pedrocostalins804122 сағат бұрын
print(link[4:]) ?????
@isrnick22 сағат бұрын
Just use a sieve like the sieve of Eratosthenes.
@SkotzGamesКүн бұрын
If you're a coder, you won't make this mistake, if you're someone who copy and pastes code, you'll make this mistake.
@RealCaddeКүн бұрын
Documentation lists thousands upon thousands of specific functions that do various string operations. Regex does all of these things with a simple to learn syntax.
@SilverSuperGamerКүн бұрын
Fun fact: a new scope is not created in a for loop
@sherwancaris5199Күн бұрын
Without music, please.....
@soldiernumberx8921Күн бұрын
Cool but you could also solve this by first removing w then make one more line to remove dot but is not so elegant
@JohannVFКүн бұрын
Noob question, but where is the value/argument for "num" being provided?
@dogslife4831Күн бұрын
Very clever use of Mod Operation
@darkblood154Күн бұрын
Javascript ==> array Python ==> list
@lebugaКүн бұрын
I personally use replace("www.", "")
@adityaalmighty1Күн бұрын
This was nice! Well done
@911SalvageКүн бұрын
Yes, I've made a similar mistake. The way the documentation for str.lstrip() was worded didn't help me one bit. Thank goodness for Google Search and StackOverflow. However, I must note that str.removeprefix() did not exist until Python 3.9.
@CripsyFriesКүн бұрын
Umm acutally str is a class 🤓
@potatofuryyКүн бұрын
A* My beloved
@nvs-different-ideas2 күн бұрын
This is why I give value pointers in my own programming languages, like # - normal value, $ - system value, @ - runner/reader values Exp. dv str 7 echo str(8) echo #str
@matthewmcvicker8242 күн бұрын
New reason to hate python: printing in the definition of a function
@RS-fz4ps2 күн бұрын
Meanwhile, JavaScript be like, 6 + 9? Nice!
@duukvanleeuwen22932 күн бұрын
I'd use recursion
@michieleding12422 күн бұрын
This is actually perfect for my game !!! Thanks lol
@PultsMoizer2 күн бұрын
Is it ok for performance to import the whole module and just use some of the functions in there? Or always better to import all 1 by 1
@fabian15512 күн бұрын
What font does this man use?
@yannisbaeyens2 күн бұрын
We do: if user_input = '' . Is this also good?
@suvetar2 күн бұрын
Good spot, that's a cheeky little impl. detail indeed! Jeff atwoood's Coding horror has a fun blog entry about obscentiy filters (20th Oct 2008). It's a fun observation if you like this stuff too!
@Gamedev-jm8el2 күн бұрын
my version: def dup(removingdups): return sorted(set(removingdups)) old = ["a", "b", "a", "c", "b", "a"] new = dup(old) print(new) # dups stand for duplicates btw # sorted maintains order and set removes dups
@ceji5662 күн бұрын
cool. your solution on my old rig takes 31 seconds. your solution on my new rig takes 14 seconds. my solution on either runs in .. error.
@TheVergile2 күн бұрын
but isnt the point of using a global that it is NOT local? As in i could be updates between two loop iterations and we want the updated value. if i wanted to specifically use the global value as is when calling the function i wouldve entered it as an argument.
@RS-fz4ps2 күн бұрын
Everyone is fighting about static or dynamic typing in C/Python, but a beginner can’t make a mistake like this when you can’t use a string where a Boolean goes.
@Chill0182 күн бұрын
but how would you use it in hundreds of function in different py files? would you import it from a separate file or define it in every one of those scripts with functions?
@nikdiklic2 күн бұрын
Python devs just discovered short circuiting
@water13742 күн бұрын
I think this guy did the videos for my Pearson textbook.
@amiganer6811302 күн бұрын
Even a old C64 had that called "Def". You showed a unnamed lambda, so it can not be reused. You can say "A=lambda..." the A is more like a function. Sometimes you need to use function, so you can put it in a lambda.
@redtomato2582 күн бұрын
Thanks a lot!
@passportbro9042 күн бұрын
me getting syked to study all day so i master decorators, me after 1 minute, im running out of weed
@passportbro9042 күн бұрын
like neo in the matrix learning kung fu in 5 seconds, buzzzzeeeezzzzee (after 1 minute) I know Decorators
@dubbynelson2 күн бұрын
python, where there's a function for everything and you learn nothing
@realitant2 күн бұрын
I wouldn't really consider this complete without an invalid selection resulting in a repro pt. Typos shouldn't cause a crash
@joemama-bo5ef2 күн бұрын
slicing? for link in links: print(link[4:])
@jambalaya9742 күн бұрын
How the fuck do I have over 5 years in python and I've never used the unpacking operator? What the fuck?
@robinsonrojaslopez52002 күн бұрын
I don't know much about how the algorithm works, but if you are looking for the smallest value, I understand that it cannot be less than zero since this way you would avoid the problem of entering a cycle in which the value is decreased. infinitely, to prevent the value from being less than zero you can look at what the weights are and look for the smallest one, in the first example -30, and add the absolute weight in the rest in this way this node (and the others with existing negative values) has a value equal to or greater than zero and the problem is avoided.
@simonebranca19723 күн бұрын
what could possibly go wrong? 🤔
@duukvanleeuwen22933 күн бұрын
OMG I literally stumbled across this problem today!!
@happyraider8153 күн бұрын
this is what i was searching for many years ago. i am too stupid before to even know what question i should be asking. i cant find it anywhere so i just quit learning python. and now here is the answer out of nowhere. maybe this is a sign
@amiganer6811303 күн бұрын
Here it is everytime "www.", that are 4 chars, so use link[4:].