5 Python tricks that will improve your life

  Рет қаралды 563,063

Aaron Jack

Aaron Jack

Күн бұрын

Пікірлер: 458
@sandervanrijn3442
@sandervanrijn3442 4 жыл бұрын
0:48 - The interactive shell (python -i file.py) 1:49 - Python Debugger (import pdb - standard library) 2:56 - Virtual Environments 4:19 - List and Dictionary comprehensions 6:34 - Lambda functions
@xle6ywek345
@xle6ywek345 4 жыл бұрын
thank you, nothing interesting
@bhuvanpatel4833
@bhuvanpatel4833 3 жыл бұрын
Thank you so much.
@inigo8740
@inigo8740 4 жыл бұрын
This guy: pdb Me: print
@irend1163
@irend1163 4 жыл бұрын
def my_func(number): if number + 2 == 4: print("program is running baby") else: print("your code suck") my_func(2) Run the program, Your code suck Me : *what the hell happened here*
@OmarKhaled-ld5ur
@OmarKhaled-ld5ur 4 жыл бұрын
@@irend1163 you sure it didn't work cause i did the same and it worked
@irend1163
@irend1163 4 жыл бұрын
@@OmarKhaled-ld5ur it just joke man, of course it's a working code
@zyz1153
@zyz1153 4 жыл бұрын
Inigo Diaz use pycharm to make it easier
@kanva4
@kanva4 4 жыл бұрын
@@OmarKhaled-ld5ur woooosh
@mateuszkolpa
@mateuszkolpa 4 жыл бұрын
It's depreciated by PEP8 to assign lambda functions. They are mainly used for stuff like this: tuples = [(1, 5), (1, 3), (1, 4)] tuples.sort(key=lambda x: x[1]) print(tuples) OUTPUT: [(1, 3), (1, 4), (1, 5)] For 1 line functions do: def add(a, b): return a + b
@tobiaswegener1234
@tobiaswegener1234 4 жыл бұрын
Interesting thanks for the info!
@TheJobCompany
@TheJobCompany 4 жыл бұрын
It's against PEP8 to not put a newline after a ":", so you would have to do it in 2 lines.
@TimoKvapil
@TimoKvapil 4 жыл бұрын
I know that this might be a stupid question for you (I AM A BIG NOOB) But is it possible to recreate this sorting thingy, without actually using lambda. I mean using only functions. (we can't use lambda at school)
@M15t4r1pP4
@M15t4r1pP4 4 жыл бұрын
Timotej Kvapil Depends on what you mean. If you’re asking about sorting a list using the key parameter and a lambda, then yes, that is doable.
@soundcore183
@soundcore183 4 жыл бұрын
lambda can be used in commands for gui elements adding values without to specify a global function. Look at it like a list comprehension inside a function taking x and making basic operations without a function name. The difference to def i think it doesn't create an object or dict in general for exuting the function header like calling eval. Most of the object types in python are hidden dictionaries. Generators and annotators weren't mentioned.
@baphnie
@baphnie 3 жыл бұрын
Don’t fall into the trap of rating code by counting lines (re: list comprehension). Your code ought to be efficient, but MUST be readable. The best code is that which future peers can read reasonably quickly.
@saminchowdhury7995
@saminchowdhury7995 4 жыл бұрын
Production quality is amazing. Thank you brother.
@phoehtaung
@phoehtaung 4 жыл бұрын
For those asking what font Dank Mono What IDE/Text Editor? VSCode What theme? Material Theme
@MrChickenpoulet
@MrChickenpoulet 4 жыл бұрын
Hey thanks for that
@zephyr7
@zephyr7 4 жыл бұрын
I was just gonna ask that
@linusbrendel
@linusbrendel 4 жыл бұрын
Thank you very much ♥️
@InarusLynx
@InarusLynx 4 жыл бұрын
A man after my own heart. A man of culture and fine taste. Excellent choice for theme.
@LavakeshPandey
@LavakeshPandey 4 жыл бұрын
Dank Mono costs £40.
@berkaykurkcu
@berkaykurkcu 4 жыл бұрын
For Windows 10 using PyCharm with Python 3.7.6 , when you initialize a virtual environment "virtualenv venv" in PyCharm Terminal on your project, new folder containts "Include,Lib,Scripts,tcl and Readme.txt" , no /bin/. What you can do is cd to Scripts and then just type "activate" . should do it.
@givdb5513
@givdb5513 3 жыл бұрын
Excellent vide, better than the majority of KZbin videos. What I really need actually for now it's a complete semantic, syntax explanation of Python and languages in general
@CordonbleuZz
@CordonbleuZz 4 жыл бұрын
List comprehensions are very powerful! i've seen it in Haskell (functional programming language) where you could write quicksort in 2 lines
@chaddaifouche536
@chaddaifouche536 3 жыл бұрын
List comprehension actually originates from Haskell, Guido was inspired by its syntax (and adapted that to Python). Of course list comprehensions in Haskell have their origin in set comprehension in Mathematics.
@bradylange
@bradylange 3 жыл бұрын
This is extremely useful! I develop a lot with Python and had no idea about the interactive shell or the Python Debugger. Thank you!
@TubularAnimator
@TubularAnimator 2 жыл бұрын
I love your channel. Been subscribed for a long time.
@AaronJack
@AaronJack 2 жыл бұрын
Thank you so much!
@claymcclendon
@claymcclendon 4 жыл бұрын
I am taking a python class rn and this is extremely helpful! Wish I knew this a couple weeks of ago.
@antoniofuller2331
@antoniofuller2331 3 жыл бұрын
Lol
@8ctrl763
@8ctrl763 4 жыл бұрын
The editing and the content is absolutely amazing (P.S - need more videos like the tinder bot may be post a building a bot or something once a week)
@gabrielh5105
@gabrielh5105 4 жыл бұрын
Wow, the edition of this video is incredible. The transitions, the camera, the light, the animations, wow. You have escalated a lot. From English teacher, passing through software developer, to a great content creator. Keep it up.
@sausas8209
@sausas8209 Жыл бұрын
I agree! Quick intro, cool but not too long or annoying splash, to the point tips and great screen capture only containing the necessary information !
@andre-barrett
@andre-barrett 4 жыл бұрын
Awesome tips and tricks. I'm not a Python developer but I've been a software engineer for 20+ years. Let's keep sharing the knowledge
@ahmedalgrai
@ahmedalgrai 4 жыл бұрын
I'm just glad that I found this channel.
@mikeblijd
@mikeblijd 3 жыл бұрын
For real for real
@FrootNinja
@FrootNinja 4 жыл бұрын
Your production value in your video has gotten better I love the new setup
@tmiae0
@tmiae0 4 жыл бұрын
Great video, keep 'em coming!
@bikerkid975
@bikerkid975 4 жыл бұрын
Loving the increase in video efficiency and overall creativity and style. Keep it up! Cheers from Montréal
@marcoscz7858
@marcoscz7858 4 жыл бұрын
Amazing, strait to the point videos. Keep them coming!
@gulshankumar17
@gulshankumar17 4 жыл бұрын
wow, thanks man. Python is really great. Yesterday I was given some excel sheets to work. Instead of doing it manually I use python pandas library.
@irend1163
@irend1163 4 жыл бұрын
What do you need to do with excel sheets? And how do you work it automatically with python?
@AU24097
@AU24097 2 жыл бұрын
@@irend1163 he’s probably reading the excel sheet and converting it into a pandas dataframe.
@grantwilliams630
@grantwilliams630 4 жыл бұрын
I’d recommend conda environments over virtualenv if you plan on using math or statistical libraries anyway. Conda’s numpy installation comes with Intel’s MKL and is worth using
@sasukesan96
@sasukesan96 4 жыл бұрын
You are my favorite youtuber, thank you so much for teaching us all that stuff. This channel is truly underrated.
@masthanjinostra2981
@masthanjinostra2981 4 жыл бұрын
Its overated or underrated?
@riteshbhartiya6155
@riteshbhartiya6155 4 жыл бұрын
You made my life so easy, and effortless 🎶
@wouldbealex
@wouldbealex 4 жыл бұрын
anaconda with a jupyter notebook makes debugging in-line. Then the code can either be run externally against the notebook or export the code to a py script. Conda also allows for multiple environments. With each environment, the developer can install whatever is best or required for that environment (e.g., _r-mutex and r-base in one env and Microsoft MOR in another without conflicts between libraries/packages. Otherwise, great starter video. Dictionaries or any other form of collection that can be traversed without array interactions is really important in all languages. Lamda and filter are great!
@JayTeaFTW
@JayTeaFTW 4 жыл бұрын
For sure my new favorite channel
@igorthelight
@igorthelight 3 жыл бұрын
Just remember guys: less code != cleaner code
@vinni113
@vinni113 2 жыл бұрын
Really great video! I've been using python for a while but learnt some new things so thanks!
@jrwkc
@jrwkc 4 жыл бұрын
bruh, ya using VSCode and then also using pdb inside of it. That's putting a hat on a hat. The debugger in VScode is life changing.
@somiljain7670
@somiljain7670 4 жыл бұрын
Thanks! for sharing these tips :)
@lpdc9767
@lpdc9767 4 жыл бұрын
Very good quality and channel consistency. Thanks for the tips.
@_gpop
@_gpop 4 жыл бұрын
List comprehensions changed my life. I should probably be working more in virtual environments though.
@dimitrisfloroskoufis_9866
@dimitrisfloroskoufis_9866 2 жыл бұрын
Good evening. I would like to ask how did your journey as a front-end programmer start? What does one need to do not in terms of knowledge. I try to get acquainted with programming but I can not understand it. I feel like I know nothing while I have been studying for hours!
@atrus3823
@atrus3823 23 күн бұрын
Good list, though I find I pretty much never end up using lambdas. The syntax is so verbose, and not that clear, and for most list operations, a generator expression is shorter and clearer. For example (x for x in [1, 2, 3] if x > 1) is clearer and actually shorter than filter(lambda x: x > 1, [1, 2, 3]). I tend to only use map and filter with regular def functions that are already defined.
@felixk2129
@felixk2129 3 жыл бұрын
Awesome, thanks a lot!
@紺野-純子
@紺野-純子 3 жыл бұрын
for the pdb you can replace it with breakpoint() instead
@JulienReszka
@JulienReszka 4 жыл бұрын
Not even 2 minutes of video and already learned something great. Thanks
@kaczordonald1426
@kaczordonald1426 4 жыл бұрын
I learned something new. Thanks!
@depressedknight369
@depressedknight369 3 жыл бұрын
this is really so helpful, always. Whether I revise things just for my knowledge sake or preparing for an insterview, I go through this video for sure.
@dinesh.p8642
@dinesh.p8642 3 жыл бұрын
your voice is nice and smooth. You are a legend!
@FernandoOrtega10
@FernandoOrtega10 4 жыл бұрын
Strings have the startswith() method to check the first letter. And you can also do set comprehensions, which use the curly brackets just like the dictionary comprehension.
@Francois3k
@Francois3k 4 жыл бұрын
Were did u go learn all your animation you put in the videos? cause it looks firee. If you can, can you tell me what courses you use an the resource cause that would be awesome 😊😊😊
@hkn5539
@hkn5539 3 жыл бұрын
Awesome. Thanks bro.
@jaykim7161
@jaykim7161 4 жыл бұрын
Thank you Aaron
@iliqnew
@iliqnew 4 жыл бұрын
5:29 I think there is a more simple way. list(fruits.keys()) list(fruits.values())
@RiedlerMusics
@RiedlerMusics 4 жыл бұрын
yes, he just wanted an example to show how list comprehensions work.
@clarianken4223
@clarianken4223 4 жыл бұрын
@Iliyan what is that technique called? pls explain how it works?
@eesakamaldien1917
@eesakamaldien1917 4 жыл бұрын
Just subscribed. This video is so helpful
@mike_kravchenko
@mike_kravchenko 4 жыл бұрын
WHAT IS INSIDE OF FOLDER "RUSSIA"?
@sickofit1304
@sickofit1304 4 жыл бұрын
I want to know that too..
@UlfKlose
@UlfKlose 4 жыл бұрын
It says “RussiaN”. I guess he’s learning the Russian language or something.
@skynet1024
@skynet1024 4 жыл бұрын
maybe its how to ask for mercy in russian (if ww3 happens)
@Turco949
@Turco949 4 жыл бұрын
It will be in another video.
@shayantej651
@shayantej651 4 жыл бұрын
Russian Nuclear Hacking codes😂😂😂😂
@toyomade
@toyomade Жыл бұрын
Whelp… as I transition from SQL heavy work into data analytics/data science and try to add Python to my skill set, I see exactly how far I have to go lol Every journey begins with a single step, off we go! Thanks, I’m sure I’ll be back (with context) so that this will make sense
@kalanachamath
@kalanachamath Жыл бұрын
Thanks man!
@shivams417
@shivams417 4 жыл бұрын
comprehensions and lambdas, filters, map are usually ignored in python, which actually very useful if used in right ways. Useful video man, keep em coming ! Thanks
@avinashtammali6130
@avinashtammali6130 4 жыл бұрын
thats quite helpuful mate thanks
@raf6125
@raf6125 4 жыл бұрын
Thank you. This was really useful
@douglasm1494
@douglasm1494 4 жыл бұрын
Thanks for the tips Shaggy
@Shadowhuntazz
@Shadowhuntazz 4 жыл бұрын
As a python beginner, this is a nice and truly useful vid man, thanks 😉
@Circumvenscion
@Circumvenscion 4 жыл бұрын
Love your vids man. Great tips, thank you!
@oliverzhang6102
@oliverzhang6102 4 жыл бұрын
Thanks a lot! That's very useful!
@emperorscotty
@emperorscotty 4 жыл бұрын
i need to start coding now that i went over all the basics
@illmar1037
@illmar1037 4 жыл бұрын
here is good tip for you, make the window full screen so the code do not get cut off. also keep your voice consistent, do not mumble.
@tucan1309
@tucan1309 3 жыл бұрын
i just wanna say u could have your life way easier if you used pycharm debugger, also u would also have way easier time with venvs and installing packages
@bendirval3612
@bendirval3612 2 жыл бұрын
Just use breakpoint() instead of importing pdb using set_trace(). No importing necessary.
@luis96xd
@luis96xd 4 жыл бұрын
Thanjs for all this tricks and tips!
@muhammadahmedjaved7691
@muhammadahmedjaved7691 4 жыл бұрын
Your videos are always very awesome and informative I always watch whenever they are released a lot of people don't yet know how good you and your video are you will get a lot of subscriber in near future if you continue to produce these awesome videos
@melboom2994
@melboom2994 4 жыл бұрын
I tried the first tip, but it doesn't seem to work for me...... my terminal looks different that yours
@anaximeno
@anaximeno 3 жыл бұрын
Usefull for sure!
@jacksontaylor3220
@jacksontaylor3220 4 жыл бұрын
Great video Aaron! Will you be continuing your data structures series soon?
@AaronJack
@AaronJack 4 жыл бұрын
hey Jackson, I'm continuing the series but don't think KZbin is the right place for it (algorithm didn't like it). So I'm working on 20 data structures and algorithms videos for a course right now. It will be fully animated and have both JS and Python versions.
@jacksontaylor3220
@jacksontaylor3220 4 жыл бұрын
Code Drip That’s awesome, totally understand. If you’re looking for people to beta test the course I’d love to check it out while you’re working on it
@AaronJack
@AaronJack 4 жыл бұрын
@@jacksontaylor3220 sure, would be great to have some feedback, could you send me an email and I'll send you a link? (codedrip4@gmail.com)
@nmtechie4033
@nmtechie4033 4 жыл бұрын
Very useful tools. Thank you so much.
@rudithboii87
@rudithboii87 4 жыл бұрын
I’m a python beginner coding on Mac OS. What program are you using to code python? Currently, I’m using a text editor (sublime text) and then using IDLE to run my code. I also don’t like using IDLE because it’s not that convenient as sublime text. It’s not very efficient because I have to keep switching back and forth. The program you’re using seems to do everything.
@JakeCallahan
@JakeCallahan 4 жыл бұрын
Use vscode. iirc it is available for Mac as well. With the extensions, it is the best free editor/idea imo. Also, if you're experimenting with python, use ipython instead of the idle. Ipython is much nicer!
@CODTALES-KILLSTREAKS
@CODTALES-KILLSTREAKS 4 жыл бұрын
Hahahahahah thank you 🙏 you made my whole week Code Drip!
@matrixv01
@matrixv01 4 жыл бұрын
Awesome videos. Keep it up!
@ragnarok7976
@ragnarok7976 7 ай бұрын
The cursive font gave me flashbacks to grade school
@activestate
@activestate 4 жыл бұрын
Great pdb tip!
@juhof.73
@juhof.73 4 жыл бұрын
Sorry but could you please make the editor full screen so we could see the full code at once. You have the the full 16:9 screen but your editor 1/3th of it.
@refaiabdeen5943
@refaiabdeen5943 4 жыл бұрын
Cheers Mate !
@NicklasBekkevold
@NicklasBekkevold 4 жыл бұрын
Hey, nice video! Your VScode looks great, which theme / fonts are you using?
@jursamaj
@jursamaj 4 жыл бұрын
Lambdas are OK for a quick and dirty one-off function passed to another function. If you use it more than once, probably better to make an actual function.
@fcmorena246
@fcmorena246 3 жыл бұрын
nice tutorial, expects more
@codecat8430
@codecat8430 4 жыл бұрын
Great stuff!
@MrEcksan
@MrEcksan 4 жыл бұрын
Great, thanks!
@TechPravinya
@TechPravinya 4 жыл бұрын
👍 Good job. Nice presentation and content.
@catfan5618
@catfan5618 3 жыл бұрын
Nice VS Code setup. Which font are you using?
@nikluz3807
@nikluz3807 4 жыл бұрын
Damn this is my fav new channel
@TheGagi82
@TheGagi82 4 жыл бұрын
Can you tell me since i want to learn Python and i am beginner,which os is better for me at start: Mac os or Linux based os ? Please,give me straight answer between those 2 options,thanks ahead.
@thesam723
@thesam723 4 жыл бұрын
The lambdas and sort function is good for data science as it's a more functional approach to programming
@depressedknight369
@depressedknight369 4 жыл бұрын
and thanks a lot for this...it was nice
@mbonuchinedu2420
@mbonuchinedu2420 4 жыл бұрын
indeed, its gonna be around for a verrrry long time
@fusrusty253
@fusrusty253 4 жыл бұрын
Well done!! Love your videos!!
@zephyr7
@zephyr7 4 жыл бұрын
If u like his font its called dank mono but its not free, if you want a free font similar to it then i suggest Victor Mono
@alikaperdue
@alikaperdue Жыл бұрын
@4:58 -> perl doing python list comprehension @fruit_names = map($_->{name}, @fruits); Syntax is a little different, but the meaning is the same. Perl can collect data from structures in one line too and before python. Data structure would be nearly the same: @fruits = ( { name => 'apple', price => 20}, { name => 'avocado', price => 10}, { name => 'orange', price => 5}, ); For only fruits beginning with "a": @fruit_names = grep(/^a/, map($_->{name}, @fruits)); For a new dict using names as keys and prices as values: %new_fruits = map(($_->{name},$_->{price}), @fruits); Perl is old stuff now, but it had some cool features. I'm glad to see Python implementing and improving on Perl ideas. But "list compression" is just a name for something that appears in other languages without the moniker. Or it exists in Perl without an official name. We called these things: "one liners"
@jonathanrodriguez1233
@jonathanrodriguez1233 4 жыл бұрын
Is that sublime? and if so can you do a tutorial on how to get that terminal and how to make it look like that? Or maybe a link if you have one. Thanks!
@irend1163
@irend1163 4 жыл бұрын
It's VSCode, a code editor same like sublime, it's open source and developed by github VSCode come with built-in terminal CMIIW he use material theme
@rogercheng1294
@rogercheng1294 4 жыл бұрын
Thanks a lot !
@EchoVids2u
@EchoVids2u 4 жыл бұрын
I still don't understand why we should use virtual environments. Why is it useful? Why not just use the system environment.
@ebentee
@ebentee 4 жыл бұрын
Thanks for sharing my bro
@hermesmercuriustrismegistu4841
@hermesmercuriustrismegistu4841 4 жыл бұрын
Amazing videos!
@dwsonye
@dwsonye 3 жыл бұрын
Kind of a plub question, I have my network+, security+, as well as Azure Admin and AWS practitioner, my question is I want to learn Python to get my feat wet but which one? P2 or P3?
@10OzGlove
@10OzGlove 4 жыл бұрын
00:19 "Learning on the job is the best way to learn and I do firmly believe that", I'm sure you don't believe in it anymore when you're dealing with someone who's learning on job through the mistakes they're making at your expense...
@fullsleevetats
@fullsleevetats 4 жыл бұрын
> I'm sure you don't believe in it anymore when you're dealing with someone who's learning on job through the mistakes they're making at your expense... That's what code reviews and peer mentoring is for.
@pauldudley1273
@pauldudley1273 3 жыл бұрын
why is a virtual environment better than using docker?
@robertwallace5498
@robertwallace5498 4 жыл бұрын
thank you for these tips :)
@tee9120
@tee9120 4 жыл бұрын
Another cool vid, thanks bruh
@jordanrenaud7189
@jordanrenaud7189 4 жыл бұрын
A trick similar to the first one is to import your other programs and then call the functions like, import main; main.add(1, 2)
@Kinos141
@Kinos141 2 жыл бұрын
other 'programs' are called classes, if I'm not mistaken.
@jordanrenaud7189
@jordanrenaud7189 2 жыл бұрын
​@@Kinos141 This was a while ago I wrote this, but no I wasn't referring to OOP (object-oriented programming) if that's what you're thinking. I meant something more along the lines of writing and importing your own modules/libraries. This could definitely involve importing classes from other files, although I'm not sure I'd necessarily call these "programs" in and of themselves, more like components of a program. Instead of typing something like 'python -i main.py' to enter the interpreter, you can just enter the interpreter normally and 'import main.py' (the same way you would import any other module/library, like pandas, numpy, or os). It's just another way of doing the same thing; although I believe you have to be in the same current working directory as that file (main.py) or else specify the path in your import statement. I love the modularity of it because you realize you can write your own libraries/tool kits. You could define all your classes in one file and import/use them in the main program if you wanted (separation of responsibility, adding another layer of abstraction). I'm not a software engineer though, so I can't speak to best practices. I'm sure someone more familiar with OOP will correct me. I'm a data analyst and tend more towards functional programming. Again though, classes are components of a program. You still need to instantiate them to use them. They are not programs in and of themselves. You define a class and then create an instance of that class (an object), from which you can define it's attributes and call it's methods. I believe this is how it works anyway. Python is multiparadigm though, so you can do OOP, functional, procedural/imperative, or a combination depending on your style or use case. For example, ML (machine learning) tends to blend OOP and functional programming (the popular ML libraries are OO but the code written to implement them tend to be functional). If anyone knows better, please keep me honest. I'd hate to misguide anyone :-P
@TauhidCodes
@TauhidCodes 4 жыл бұрын
Really helpful. What screen recorder do you use?
10 Python Tips and Tricks For Writing Better Code
39:21
Corey Schafer
Рет қаралды 1,3 МЛН
25 nooby Python habits you need to ditch
9:12
mCoding
Рет қаралды 1,8 МЛН
哈哈大家为了进去也是想尽办法!#火影忍者 #佐助 #家庭
00:33
火影忍者一家
Рет қаралды 125 МЛН
РОДИТЕЛИ НА ШКОЛЬНОМ ПРАЗДНИКЕ
01:00
SIDELNIKOVVV
Рет қаралды 3,8 МЛН
This mother's baby is too unreliable.
00:13
FUNNY XIAOTING 666
Рет қаралды 38 МЛН
Why I Can't Move Back to America
7:50
Aaron Jack
Рет қаралды 27 М.
5 Good Python Habits
17:35
Indently
Рет қаралды 564 М.
5 Nooby Coding Mistakes You NEED To Avoid
19:45
Tech With Tim
Рет қаралды 14 М.
5 Useful F-String Tricks In Python
10:02
Indently
Рет қаралды 315 М.
Let's code a beginner's Python BANK PROGRAM 💰
15:01
Bro Code
Рет қаралды 204 М.
5 Really Cool Python Functions
19:58
Indently
Рет қаралды 63 М.
3 PYTHON AUTOMATION PROJECTS FOR BEGINNERS
17:00
Internet Made Coder
Рет қаралды 1,6 МЛН
PLEASE Use These 5 Python Decorators
20:12
Tech With Tim
Рет қаралды 115 М.
Please Master These 10 Python Functions…
22:17
Tech With Tim
Рет қаралды 181 М.
哈哈大家为了进去也是想尽办法!#火影忍者 #佐助 #家庭
00:33
火影忍者一家
Рет қаралды 125 МЛН