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*
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.
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
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)
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.
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.
Excellent vide, better than the majority of UA-cam videos. What I really need actually for now it's a complete semantic, syntax explanation of Python and languages in general
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.
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.
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.
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
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!
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 😊😊😊
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
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
@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"
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.
Thats not CS logo its Half lifes. CS started as Half life mod before becoming its own game. It was in the logo of Half life because in physics traditionally half life of radioactive decay is marked with lambda the greek letter.
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
hey Jackson, I'm continuing the series but don't think UA-cam 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.
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
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...
> 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.
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.
from python 3.6 or 3.5 you don't have to install virtualenv, because venv now inside the python just type "python -m venv yourproject/venv", next source/bin/active and that's all docs.python.org/3/library/venv.html
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!
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!
No need to install virtualenv, it's already builtin into python 3 (2 is no longer supported), just use python -m venv env to create a virtual environment called env.
the trick of pdb is already inclueded in the software edu.python (french software made to learn python quite powerfull) and he underline your errror when he detect it s if you new on python this software could be good start to limitate error and understand it better :p
This guy: pdb
Me: print
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*
@@irend1163 you sure it didn't work
cause i did the same and it worked
@@OmarKhaled-ld5ur it just joke man, of course it's a working code
Inigo Diaz use pycharm to make it easier
@@OmarKhaled-ld5ur woooosh
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
thank you, nothing interesting
Thank you so much.
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.
Production quality is amazing.
Thank you brother.
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
Interesting thanks for the info!
It's against PEP8 to not put a newline after a ":", so you would have to do it in 2 lines.
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)
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.
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.
For those asking what font
Dank Mono
What IDE/Text Editor?
VSCode
What theme?
Material Theme
Hey thanks for that
I was just gonna ask that
Thank you very much ♥️
A man after my own heart. A man of culture and fine taste. Excellent choice for theme.
Dank Mono costs £40.
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.
I'm just glad that I found this channel.
For real for real
Excellent vide, better than the majority of UA-cam videos.
What I really need actually for now it's a complete semantic, syntax explanation of Python and languages in general
Great video, keep 'em coming!
Amazing, strait to the point videos. Keep them coming!
I am taking a python class rn and this is extremely helpful! Wish I knew this a couple weeks of ago.
Lol
Loving the increase in video efficiency and overall creativity and style. Keep it up! Cheers from Montréal
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)
This is extremely useful! I develop a lot with Python and had no idea about the interactive shell or the Python Debugger. Thank you!
I love your channel. Been subscribed for a long time.
Thank you so much!
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
You are my favorite youtuber, thank you so much for teaching us all that stuff. This channel is truly underrated.
Its overated or underrated?
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.
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 !
List comprehensions are very powerful!
i've seen it in Haskell (functional programming language) where you could write quicksort in 2 lines
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.
Your production value in your video has gotten better I love the new setup
For sure my new favorite channel
Thanks! for sharing these tips :)
You made my life so easy, and effortless 🎶
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.
What do you need to do with excel sheets?
And how do you work it automatically with python?
@@irend1163 he’s probably reading the excel sheet and converting it into a pandas dataframe.
Not even 2 minutes of video and already learned something great. Thanks
I learned something new. Thanks!
Just remember guys: less code != cleaner code
Very good quality and channel consistency. Thanks for the tips.
5:29 I think there is a more simple way.
list(fruits.keys())
list(fruits.values())
yes, he just wanted an example to show how list comprehensions work.
@Iliyan
what is that technique called?
pls explain how it works?
WHAT IS INSIDE OF FOLDER "RUSSIA"?
I want to know that too..
It says “RussiaN”. I guess he’s learning the Russian language or something.
maybe its
how to ask for mercy in russian
(if ww3 happens)
It will be in another video.
Russian Nuclear Hacking codes😂😂😂😂
Really great video! I've been using python for a while but learnt some new things so thanks!
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.
Love your vids man. Great tips, thank you!
your voice is nice and smooth. You are a legend!
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
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!
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 😊😊😊
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
As a python beginner, this is a nice and truly useful vid man, thanks 😉
Awesome, thanks a lot!
Thanks man!
Thanks for the tips Shaggy
Well done!! Love your videos!!
Thank you Aaron
Thank you. This was really useful
Awesome videos. Keep it up!
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
Thanjs for all this tricks and tips!
Cheers Mate !
Usefull for sure!
Awesome. Thanks bro.
@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"
List comprehensions changed my life. I should probably be working more in virtual environments though.
Great stuff!
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.
Just subscribed. This video is so helpful
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.
Great pdb tip!
Hahahahahah thank you 🙏 you made my whole week Code Drip!
for the pdb you can replace it with breakpoint() instead
Thanks a lot! Very useful stuff!
6:40 After that "CS lambda logo" I thought you'd say "lambda is just exactly the same thing you've seen in Counter Strike game" lol
Thats not CS logo its Half lifes. CS started as Half life mod before becoming its own game. It was in the logo of Half life because in physics traditionally half life of radioactive decay is marked with lambda the greek letter.
Damn this is my fav new channel
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
Great video Aaron! Will you be continuing your data structures series soon?
hey Jackson, I'm continuing the series but don't think UA-cam 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.
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
@@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)
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
i need to start coding now that i went over all the basics
Just use breakpoint() instead of importing pdb using set_trace(). No importing necessary.
thats quite helpuful mate thanks
Great, thanks!
Another cool vid, thanks bruh
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...
> 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.
The cursive font gave me flashbacks to grade school
thank you for these tips :)
Amazing videos!
4:39 "we have to do something like this" - not true, you could just call .values()
incorrect, that also includes prices
Very useful tools. Thank you so much.
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.
Thanks a lot !
Thanks for sharing my bro
Your voice makes me fall asleep 😴
So soothing
Hey, nice video! Your VScode looks great, which theme / fonts are you using?
indeed, its gonna be around for a verrrry long time
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.
great vid thanks for the tips
nice tutorial, expects more
good job bro!
and thanks a lot for this...it was nice
quality,
Would you be able to do small projects for beginners ?
Thanks!
👍 Good job. Nice presentation and content.
from python 3.6 or 3.5 you don't have to install virtualenv, because venv now inside the python just type "python -m venv yourproject/venv", next source/bin/active and that's all
docs.python.org/3/library/venv.html
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
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!
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!
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
U da besst, greetings from Dominican Republic!
No need to install virtualenv, it's already builtin into python 3 (2 is no longer supported), just use python -m venv env to create a virtual environment called env.
the trick of pdb is already inclueded in the software edu.python (french software made to learn python quite powerfull) and he underline your errror when he detect it s if you new on python this software could be good start to limitate error and understand it better :p
The lambdas and sort function is good for data science as it's a more functional approach to programming
awesome !