5 Random Useful Python Functions

  Рет қаралды 21,235

Indently

Indently

Күн бұрын

Пікірлер: 40
@chyldstudios
@chyldstudios 8 ай бұрын
This video is choice(['cool', 'amazing', 'random'])
@__christopher__
@__christopher__ 8 ай бұрын
Replace choice with sample of size 3
@joshix833
@joshix833 8 ай бұрын
__import__("random").Random(42).choice(("worst", "worse", "bad", "good", "better", "best"))
@nextisnowmain
@nextisnowmain 7 ай бұрын
Amazing ❤
@basurigos
@basurigos 8 ай бұрын
Hey man, your videos are amazing, could you please make a video about how the built in functions work under the hood, like how does __import__ or __build_class__ work, i know those are do not touch functions, but I'm curious
@souris_a_boule5695
@souris_a_boule5695 8 ай бұрын
Something that can be interesting is to use the Random class from this module. It provide exact same functions as method but each instance have its own seed and and are not shared with the global seed. So for example you can use this in a class that have random behavior where each instances have their own seed and each random function call will not affect another instance
@danielcrompton7818
@danielcrompton7818 8 ай бұрын
Thank you!😊
@williamsquires3070
@williamsquires3070 8 ай бұрын
Hint: if you need a list of unique random integers, you combine the list comprehension that generates an ordered list from (x,y), and then call shuffle() on it, where x < y and are integers. 😊
@davidmurphy563
@davidmurphy563 8 ай бұрын
Ok, I was into the third function before the penny dropped and I twigged you were covering the `import random` module and not just going through random functions!
@killerfc
@killerfc 8 ай бұрын
🤣 me too
@Indently
@Indently 8 ай бұрын
It was a silly wordplay with the title, I hope you enjoyed the video though! :)
@davidmurphy563
@davidmurphy563 8 ай бұрын
@@Indently Yeah, it was good! I like your vids. Well, I knew it already but, I'm sure many don't and I watch just in case. :)
@danielcrompton7818
@danielcrompton7818 8 ай бұрын
@@Indentlyyes I get the joke now!!
@Russet_Mantle
@Russet_Mantle 6 ай бұрын
7:51 the words you're looking for are "with replacement" (choice) and "without replacement" (sample) as in statistics lingo
@sovereignlivingsoul
@sovereignlivingsoul 7 ай бұрын
good coding practices, that is what i like to learn, thanks for your input
@michaelhoffmann2891
@michaelhoffmann2891 8 ай бұрын
Addendum: do NOT use any of these for cryptographic, or even scientific, code! 😆
@tinahalder8416
@tinahalder8416 7 ай бұрын
In ML to randomise data, these functions are used. For crypto there is secure module
@alboz1327
@alboz1327 7 ай бұрын
Why wouldn't I use these for sci programming... I can always specify a seed anyway, to make experiments testable. I would be interested if you wanted to give more insights into what you are saying, thanks!
@yash1152
@yash1152 8 ай бұрын
8:48 shuffle vs sample can trip over many ppl many times ig
@Reojoker
@Reojoker 8 ай бұрын
Seed is also useful if you write software for research as it allows your results to be easily reproducible.
@69k_gold
@69k_gold 8 ай бұрын
Does choices() always guarantee that we won't get the element at the same index twice if we call it with a number less than len(list)
@k.r.jester5406
@k.r.jester5406 8 ай бұрын
No, if you want that you should use random.sample()
@sadhappy8860
@sadhappy8860 8 ай бұрын
I knew about choices but sample would have been really helpful about a year ago
@paulosergioschlogl9550
@paulosergioschlogl9550 8 ай бұрын
nice video. thanks
@dipeshsamrawat7957
@dipeshsamrawat7957 8 ай бұрын
Nice! Keep it up. 💯
@danielcrompton7818
@danielcrompton7818 8 ай бұрын
Hey, will you make any more iOS videos, that is actually how I found your channel!!! I also program in Python so your videos are still really interesting
@_HetShah_
@_HetShah_ 8 ай бұрын
Do you think there's a way to reverse engineer randomness using seed in some way?
@hindsighttt
@hindsighttt 8 ай бұрын
im pretty sure there is but you gotta look at the code of the random library and do it that way
@DendrocnideMoroides
@DendrocnideMoroides 8 ай бұрын
There definitely is, if you want a more secure version of the random library then use the secrets library in Python.
@katrinabryce
@katrinabryce 8 ай бұрын
Yes, and a lot of security work goes in to making sure people aren't able to do that. Cloudflare for example use a bunch of lava lamps to generate their random seed.
@dbottesi
@dbottesi 8 ай бұрын
Another great video!! Thumbs 👍
@winTer_x64
@winTer_x64 7 ай бұрын
More flet tutorials plzzz
@Lets_code_together_
@Lets_code_together_ 8 ай бұрын
i have applied for coupoun code please provide me it is so much helpful for me
@Pawlo370
@Pawlo370 8 ай бұрын
how to know seed?
@danielcrompton7818
@danielcrompton7818 8 ай бұрын
Make it up! It doesn’t matter what it is, just so long as it is consistent for the best results
@rishiraj2548
@rishiraj2548 8 ай бұрын
🙏🙂👍
5 Tips To Write Better Python Functions
15:59
Indently
Рет қаралды 110 М.
5 Wacky Python Features
15:37
Indently
Рет қаралды 12 М.
Trick-or-Treating in a Rush. Part 2
00:37
Daniel LaBelle
Рет қаралды 47 МЛН
БУ, ИСПУГАЛСЯ?? #shorts
00:22
Паша Осадчий
Рет қаралды 2,8 МЛН
How To Choose Mac N Cheese Date Night.. 🧀
00:58
Jojo Sim
Рет қаралды 86 МЛН
CI/CD Pipeline with Github Actions and Vercel
8:03
Michael Padin
Рет қаралды 5
Is Functional Programming DEAD Already?
21:07
Continuous Delivery
Рет қаралды 68 М.
10 Neat Ways To Use Underscore In Python
18:17
Indently
Рет қаралды 23 М.
Please Master These 10 Python Functions…
22:17
Tech With Tim
Рет қаралды 214 М.
How To Write Better Functions In Python
14:17
Indently
Рет қаралды 48 М.
Why Unreal Engine 5.5 is a BIG Deal
12:11
Unreal Sensei
Рет қаралды 1 МЛН
Python List Comprehensions Made Easy!!
11:50
Travis Media
Рет қаралды 18 М.
Generate random numbers in Python 🎲
8:03
Bro Code
Рет қаралды 70 М.
PLEASE Use These 5 Python Decorators
20:12
Tech With Tim
Рет қаралды 122 М.