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.
Excellent vide, better than the majority of RU-vid videos. What I really need actually for now it's a complete semantic, syntax explanation of Python and languages in general
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.
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 😊😊😊
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.
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.
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
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
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.
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
I love virtual environments. I mainly use them for system tests where the system is usually a medical device running Linux. I mostly do image processing within the venv - the system itself remains completely unchanged by the test. scp all the python stuff onto the remote system, execute via ssh, scp everything back onto the local machine and clean up the remote system. No installations, yet full fledged image processing.
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.
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!
dang dude you have quite the following so do you work (onsite or remote) for a company or do you only freelance? and what code stack have you been using primarily? im located in Austin, Texas and have been learning JS and now Py I want to start looking for positions as a coder and want to go about it the best wayyyyy