List Comprehension - BEST Python feature !!! Fast and Efficient

  Рет қаралды 186,633

Python Simplified

Python Simplified

Күн бұрын

In this tutorial, we will learn all about list comprehensions and how they can make our Python journey much easier and much more efficient!! 🤓🤓🤓
List comprehensions provide a shorter and faster alternative to "for" loops (especially when combined with conditional statements as well as append commands). And best of all - it takes only 1 LINE OF CODE! 😱
This video offers 3 separate coding exercises, various examples and colorful illustrations of the concepts involved. Please feel free to use my code and artwork, you can find it in the link below:
⭐⭐ clone my code: ⭐⭐
* Sorry code is unavailable, RIP Wayscript 😭😭😭*
And on a festive note...
🍁HAPPY CANADA DAY!!!🍁
to all my fellow Canadians! (and other Earth dwellers who celebrate 😉)
Sending you lots of love from beautiful British Columbia! 💗💗💗
⏰ time stamps ⏰
____________________
00:00 - intro
00:17 - what is a list comprehension?
01:22 - for loop vs list comprehension
02:40 - coding example
06:07 - conditional list comprehension
06:27 - coding example 2
09:02 - list comprehension on strings
09:29 - coding example 3
12:09 - else if list comprehension
13:50 - coming soon: dictionary comprehension
14:12 - thanks for watching!
🐍🐍 related tutorials of mine 🐍🐍
_____________________________________
- For Loops:
• Python For Loops - Pro...
➡️➡️ starter code ⬅️⬅️
__________________________
fruits = ["apples", "bananas", "strawberries"]
for fruit in fruits:
print(fruit)
💳💳 credits 💳💳
_______________________
- Beautiful Icons are by:
www.flaticon.com/
- Beautiful Like/Share/Subscribe video graphics by:
mixkit.co/
🤝 connect with me 🤝
_______________________
- Github: github.com/MariyaSha
- Discord: / discord
- LinkedIn: / mariyasha888
- Twitter: / mariyasha888
- Blog: pythonsimplified.ca

Пікірлер: 496
@patricklehmann24
@patricklehmann24 Жыл бұрын
Using list comprehension for print is a very bad example. Compared to the the ordinary for-loop, an implicit list of return values from print is generated. Also the statement, that append(...) isn't used in list comprehension isn't true. It's not explicitly written as code, but somehow, elements need to be added to the list. The presentation states that some code is faster than other code, but no evidence is shown e.g. by using timeit. boolean values shouldn't be compared (==) with True. At first use "is True". At second, a call to the "is" operator can be skipped, because a boolean can be used directly in an if statement. Moreover there is no if-statement needed, as booleans can be directly converted to integers by calling int(...). list comprehension for strings ... I have no words how silly this is. --------------- Sorry, but such tutorials are the root cause for so many bad Python code in the world. Just because you can do it, doesn't mean you should do it; neither you should teach others ! There are many good use cases for list comprehensions. There are also lots of use cases when list comprehensions are more compact, more readable and way faster than ordinary loops. But the given examples in this tutorial are neither.
@wanted4515
@wanted4515 Жыл бұрын
Waited for such comment for a long time. You've summarized my thoughts in it as well Thanks 🙂
@PythonSimplified
@PythonSimplified Жыл бұрын
Thank you for the feedback Patrick! 😀 I appreciate you taking the time to write this comment, I'll try to touch on all the topic you brought up even though I probably have much more to say hahaha (It becomes a bit philosophic towards the end, so I'm gonna keep it brief 😅) First things first - there's always a certain level of abstraction when trying to convey language concepts. Even my brilliant professors in university use examples that don't necessarily have real life applications and yet - demonstrate the subject really well. It's not an uncommon thing when you learn something new, especially when it's syntax related. In terms of the print statement - it's the easiest way to demonstrate how a block of code works. If you truly want to learn something step by step, this is the most logical place to begin with. It's quite obvious that printing list items is not the purpose of list comprehensions, and yet it demonstrates what's going on behind the scenes very well. In terms of the "append()" method, you can easily verify on your end whether your assumption is correct 😉 For this, you will need a very long spreadsheet, in my case I'm using one with 34861 rows (called "ingredients.csv", in particular its "Ingredient Name" column. Please replace it with your own data as I can't share my file because it's part of my school project that is currently being graded): import time import pandas as pd data = pd.read_csv("ingredients.csv") my_list = list(data["Ingredient Name"]) new_ingredients = [] start = time.time() for i in my_list: new_ingredients.append(str(i).upper()) print("for loop timing:", time.time() - start) start = time.time() fruits = [str(i).upper() for i in my_list] print("list comp timing:", time.time() - start) The results I'm getting on my end reflect a difference between both implementations: for loop timing: 0.004999637603759766 list comp timing: 0.003046274185180664 I ran it several times and list comprehension always has the upper hand (testing on an Intel Alder Lake 12th gen CPU). Now, please keep in mind that it's not a very big difference! but the longer your list is - the more it makes sense to avoid "append()". So just for the sake of the distinction - the "append()" method adds items to the end of a given list. It's very popular but there are different algorithms that can implement that. We know for a fact that the results are equivalent to a regular "append()" method - but we don't really know the exact algorithm used within the list comprehension given the difference in speed. It must be different, otherwise - it would have been reflected in the results. I actually found a very fascinating stack overflow post on the topic that you might enjoy 😊: stackoverflow.com/questions/22108488/are-list-comprehensions-and-functional-functions-faster-than-for-loops So my apologies for not including this timing code within the tutorial - I just rarely get requests from viewers to prove every word I say hahaha... it's not easy to cover concepts when you stop every 5 seconds to provide evidence... but I promise I'll take that into consideration in the future! 😁 As my channel grows it brings a different type of audience - so of course I want you to be able to enjoy my videos as well. I just need to make sure it's not gonna upset my existing audience as they usually verify those things on their end, and often their conclusions are shared in the comments. In terms of the int() statement - I use it all the time, and you can checkout many other tutorials of mine to verify that! The only problem with your suggestion is - it defeats the purpose of this example as it skips the "if" and "else" statement I've been aiming to demonstrate. Boolean and integers were used to showcase that not only strings can be adjusted within a list comprehension, but the purpose of this example is the conditionals - not the conversion from boolean to integers... it just that at this point - I don't know if you're really providing feedback or just looking for things to pick on 😅😅😅 I fell like I'm feeding you with a spoon, even though I'm assuming you are well aware of most of the things I mentioned. Nevertheless, here's the last and ⭐ most important ⭐ part of my reply: From your perspective - I'm the root cause of all evil. But for other people - I'm the only reason why they have enough confidence to start coding. I simplify things so much that anybody can understand, regardless of their computer science experience or age. Programing doesn't come very easy for some folks. And I must mention that by using words like "silly" and "bad Python code" you are actually discouraging many passionate future developers who just happen to have a different starting point from yours. Those "best practices" we advocate for - is not something we get out of the blue - it's something we develop with time and experience. If you don't allow people to make their own mistakes - they will never learn. They'll just keep repeating what somebody else said without even knowing why. I don't consider this as "learning", it's more of "don't ask questions and do what you're told". You will never see things like this on my channel as it goes against everything I believe in. Trial and error is key, and the more examples you see - the better you get! Whether those are "good examples" or "bad examples" depends on specific situations and on the eyes of the beholder. There is no "one size fits all" universal coding standard and our industry is so dynamic that constraining yourself to a per-defined set of "dos" and "don'ts" limits your creativity and it assures that you will never ever innovate anything or discover something new. I find this approach very problematic, as what is silly to you - may be the perfect solution to somebody else's problem if not today - maybe sometime in the future. You obviously have some advanced knowledge in your field, but why don't you use it to motivate and encourage less experienced developers? There are plenty of professionals here in the comments providing help and advice to others, and I really think you'd be a perfect fit! 😀 I would love to see you around despite our differences, I do enjoy reading viewer critiques and I think your comment is very important therefore I pin it 😉 Cheers! and hopefully my you'll find my future videos a bit less problematic 😊 hahahaha
@yahgooglegan
@yahgooglegan Жыл бұрын
​@@PythonSimplified From complexity point of view both are the same, however since Python is interpreted the more bullshit you write in your code the slower it goes.
@PythonSimplified
@PythonSimplified Жыл бұрын
@@yahgooglegan I'm a bit confused as to what you define as "bullshit" 😅... does it mean you're against list comprehension altogether? It doesn't seem to slow down anything - on the contrary, it's faster than traditional for loops (you can verify that with the code example from my previous comment). I don't know how this can be a bad thing... but maybe I'm missing something? 🤔
@yahgooglegan
@yahgooglegan Жыл бұрын
​@@PythonSimplified "bullshit" = "verbosity". No, I'm not against i'm PRO, in fact you have proven your point very professionally and your tutorials are very good. What i wanted to say is that Python being interpreted (and dynamically typed ) will not optimize anything that you write as opposed to a C++ compiler. So even if you have 2 algorithms with the same mathematical complexity the one written with more instructions, function calls and variables will take more time to execute. This is also the case with append vs an optimized way like list comprehension. List comprehension is guaranteed to use the minimalist approach as compared to any verbosely written equivalent algorithm.
@PythonSimplified
@PythonSimplified Жыл бұрын
Thank you so much for all the lovely comments folks! I'm off to a Canada day camping trip deep in the wilderness, will catch up with all your messages once I'm back! 😃 (including on Twitter, LinkedIn and Discord 😉)
@flyers2000
@flyers2000 10 күн бұрын
what;s your onlyfans? we have AI to do coding now.....
@guycostco7516
@guycostco7516 Жыл бұрын
You are a life saver. It is so much easier learning Python with your fantastic tutorials. Keep em coming! Cheers from Montreal.
@jlindsley9288
@jlindsley9288 Жыл бұрын
Excellent tutorial. List comprehension is one of those things you think you understand until you try to explain it to someone. Always good to refresh your knowledge.
@barnabykent6698
@barnabykent6698 Жыл бұрын
Always thought you had excellent teaching skills. The new slick look to these tutorials makes this the best place on the internet for (true) beginner Python instruction. Really looking forward to this channel going insanely viral in the future.
@simonchantack23
@simonchantack23 Жыл бұрын
This was AWESOME!! I really like the way you simplified things. Great examples. Will love to see the same using dictionaries. Thanks so much!!
@sasuke21153
@sasuke21153 Жыл бұрын
I stopped using python for almost 2 months(not really long) but I was looking for some quick refresher with the language, and your videos really helped me a lot. I just want to say thank you so much!!!!.
@Tooxcade
@Tooxcade Жыл бұрын
Absolutely a fantastic teacher. I like the way you explained it. Thank you!
@MegaJohn144
@MegaJohn144 Жыл бұрын
I have read and watched a lot of tutorials about Python list comprehension. This was the best. I think now I can write a list comprehension without copying somebody else's code.
@ahmedelsayed3133
@ahmedelsayed3133 Жыл бұрын
You make complicated things look easy. You are amazing!
@AlbertoNao
@AlbertoNao Жыл бұрын
I'm following you and watching your video to improve my Python, I'm using Py since 2 years every day with AWS-Lambda functions but there are always something new to learn! And you have an awesome voice so I improve my English too. Hello from Italy.
@rahulkmail
@rahulkmail Жыл бұрын
Excellent. The way you covered the example's, just mind blowing.
@PythonSimplified
@PythonSimplified Жыл бұрын
Thank you so much Rahul! Super glad you liked it! 😁😁😁
@jamvin5647
@jamvin5647 Жыл бұрын
I like this tutorial because it was easy to follow along and understand the basic ideas behind list comprehensions. This is the video I was needing, thank you!
@katbryce
@katbryce Жыл бұрын
Some additional things I find useful: For more complicated list comprehensions, create a function that takes the list item as a single argument, and returns the result, then use that in the list comprehension in much the same way as you used print(). If you have a really huge list, I sometime deal with lists that have 10m+ items in them, then instead of using list comprehension, use multiprocessing.Pool().map(function,list) to use all of your available CPU cores. This doesn't seem to work so well in Windows, but works very well in Linux and FreeBSD.
@PythonSimplified
@PythonSimplified Жыл бұрын
Awesome tip Katrina!! 😀😀😀 Thank you so much for another insightful and super helpful comment! Pinning it to the top! (as usual 🤪)
@suvimpemel5583
@suvimpemel5583 Жыл бұрын
Really useful information.
@Bruno-oj3zb
@Bruno-oj3zb Жыл бұрын
@@PythonSimplified Hello, Im new to python and I made a little script that automates keystrokes , only problem is it only works if the game window is up front, and I seem not to get it to work minimised , so I can use my PC while the script is running, for youtube for example , I tried : pyautogui, pydirectinput, pyautoit, AHK, But it seems Im to dum dum to make it work to send keystrokes Only to the game window . Can someone kindly guide me a bit. Thanks.
@V.Z.69
@V.Z.69 Жыл бұрын
@@Bruno-oj3zb AHK should work. I use AHK all the time. Assign the macro to a key on the keyboard. Run the script. It's so easy. Use F5 to simulate "SHIFT + h" f5:: send {Shift}+{h}
@magetaaaaaa
@magetaaaaaa Жыл бұрын
Is this just so the code is more readable? Wouldn't it be the same result in the end? Splitting it into a function and the list comprehension vs doing it all in list comprehension?
@kevinmcaleer28
@kevinmcaleer28 Жыл бұрын
Great tutorial, I'd heard of list comprehension, but hadn't really understood it until you explained it. I can't wait to start using this now!
@John-jr3zs
@John-jr3zs 3 ай бұрын
Love you videos! - thank you so much for making them :) - I always learn a lot from them!
@anitasunildesai
@anitasunildesai 8 ай бұрын
Thanks a lot for the tutorial and you are exuberant. Love your teaching style too. Looking forward for more. 🙏🏼
@pierre2598
@pierre2598 Жыл бұрын
Thank you Mariya, the structure of your video makes it easy to follow along, great work.
@fedafedafeda5977
@fedafedafeda5977 Жыл бұрын
You've done the entire course with much practical and super exiting way. so keep doing more videos and you are absolutely gorgeous!
@shaurryabaheti
@shaurryabaheti 5 ай бұрын
I just used list comprehension for my huffman coding project, works so fast I love it!!
@NitSarReb
@NitSarReb Жыл бұрын
I'm really happy that I found you channel. I learn a lot of topics in a really easy way. thank you so much dear. You are best in what you do.
@DerFlotteReiter
@DerFlotteReiter Жыл бұрын
I love how you edit your videos. Must be a lot of work but it pays off. Great to watch and learn!
@PythonSimplified
@PythonSimplified Жыл бұрын
Thank you so much Matthias! 😊
@colinclarke3338
@colinclarke3338 Жыл бұрын
Thanks for your efforts Mariya. I’m new to Python and you have such a great teaching style.
@Abdulbasittia
@Abdulbasittia Жыл бұрын
Your teaching is very clear, thank you so much 🙏
@spyroskrinas9147
@spyroskrinas9147 Жыл бұрын
Thank you so much, I 've just become a new follower. Keep up the good work.
@AlessandroGuarita
@AlessandroGuarita 9 ай бұрын
Wow, KZbin just put this video in my timeline and I am very grateful. You didactic is awesome. It was an automatic subscription
@christsciple
@christsciple Жыл бұрын
Some folks have pointed out improvements you could utilize in your code and the examples you use but I think it's fine to demonstrate basic Python functions and libraries in a video such as this. I've been programming and writing code since I was 11, I'm now 34 and have had titles such as "developer", "engineer", "architect", and now "entrepreneur". In my very humble opinion, you've done a great job at teaching the basics to folks who want to learn Python. You could always make follow-up videos demonstrating improvement on your code used in this video and discuss the "why" and "how" behind the techniques, but it's not critically important. Anyway, great video I really enjoyed it and always learn something new (or something I've forgotten previously!). Please, keep making videos and many of us will continue to support you!
@blevenzon
@blevenzon Жыл бұрын
So much to learn so little time and brain. Thank you 🙏
@colinclarke3338
@colinclarke3338 Жыл бұрын
Thanks M. I found this from the dictionary comprehension video. Great work. Thanks again.
@DonEdward
@DonEdward Жыл бұрын
This is EXACTLY what I need to get through a coding test! They asked to turn every other letter in a string from kwargs into upper, and every other lower. Thanks, Mariya! Perfect help, perfect timing!
@DonEdward
@DonEdward Жыл бұрын
I still have the problem of making each index (i % 2 == 0) for the .upper(). Then else .lower().
@phovos7618
@phovos7618 Жыл бұрын
Thank you! Your enthusiasm is encouraging and exciting. I hope to learn a lot more from you. Battle station is so on point. I bet you rack up the frags.
@azhar145
@azhar145 9 ай бұрын
Awesome video. You made the whole concept so easy. Thank You.
@JohnHumphrey
@JohnHumphrey Жыл бұрын
I especially enjoy how you get a nice chunk of information into a 15 minute video. Well done! I searched your channel but I wonder if you have anything on using websockets in python. Thanks!
@Slade1G
@Slade1G 8 ай бұрын
I love your way of teaching, I understand it perfectly,
@americovaldazo6373
@americovaldazo6373 Жыл бұрын
Python Simplified is the top python programming KZbin channel and Mariya is the greatest teacher of the world. Greetings from Argentina.
@MrTschetsche
@MrTschetsche Жыл бұрын
Thank you very much for the nice explanations. You help me to see things differently every time.
@Canucs1
@Canucs1 9 ай бұрын
Thanks a lot Maria :) Love your videos. It was an awesome "list comprehension" explanation.
@igka4029
@igka4029 Жыл бұрын
Спасибо, классная подача. Огромное удовоьствие смотреть такие туториалы.
@PythonSimplified
@PythonSimplified Жыл бұрын
Огромное спасибо Ig!!! 😀😀😀
@munivoltarc
@munivoltarc 9 ай бұрын
One should learn from her how to teach to viewers or students offline or online, she got a gift of smile on her face, that makes her more beautiful in teaching, she is so passionate in teaching.
@fabio89ferreira
@fabio89ferreira Жыл бұрын
These tutorials are incredible!!
@seanquaint3258
@seanquaint3258 Жыл бұрын
Very cool tutorial. Thanks. Nice shirt too. Happy Canada Day!
@jenschultz02
@jenschultz02 Жыл бұрын
Thank you. This idea was breaking my brain. I don't understand completely yet, but I feel much better about it.
@parulsharma390
@parulsharma390 Жыл бұрын
This channel is a life saver 💕 thanks girl ✨
@rexsu9202
@rexsu9202 Жыл бұрын
Love the way you teach ! Thanks !!!!
@MrTechUser
@MrTechUser Жыл бұрын
Excellent! And yes, dictionary comprehension would be greatly appreciated.
@PythonSimplified
@PythonSimplified Жыл бұрын
Thank you so much Dan! 😀😀😀 Dictionary comprehensions coming soon!
@gugl3x
@gugl3x Жыл бұрын
Great one! Can't wait for the dictionary comprehension.
@kostas6915
@kostas6915 Жыл бұрын
Mariya very good work, both in terms of material covered but also in terms of exposition! Yes please do a video in dictionary comprehension. Also would be interesting to have a sum up on various data structures in python and the main data libraries like numpy and pandas. Maybe a long one, but you are the teacher!
@justiccoolman1816
@justiccoolman1816 Жыл бұрын
For the camal case conversion instead of cutting off the first element at the end of the code: Skip the first element of the string before it is passed into the listcomprehension. And just concate the result to the first string element. So also a first lower letter will work.
@nonoobott8602
@nonoobott8602 Жыл бұрын
Great video tutorial...been trying to be able to include 3 conditions in a list comprehension and you made it so easy to do. Thanks so much for sharing
@PythonSimplified
@PythonSimplified Жыл бұрын
Yeey!! I'm super happy to help! Thank you for the lovely comment Nono! 😁
@alexandreknecht7423
@alexandreknecht7423 Жыл бұрын
Hi ! On a regulary basis I have to help junior to use Python and list/dict comprehension are the first thing I demonstrate because it ease work in a lot of situation ! Thanks for demonstrating it, I will keep the video to send it to some junior when I feel that they do not fully understand. Do you plan to do a video for other derivative of using list comprehension syntax like using next(), any() or all(), I use these a lot too and would be good to have a tutorial on that ;). Great videos ! Keep on ! Ps : You are not evil nor responsible for bad python code, we all start as beginners and don’t need to be pep8 compliant on day 1 so keep demonstrate with clear example and senior developer are here to do code review and gives their experienced point of view to improve newcomers’ code, but not on youtube !
@thatotherguy4245
@thatotherguy4245 4 ай бұрын
Great explanation/demo, thanks!
@JokerArgentino
@JokerArgentino Жыл бұрын
Cool, now I have learned a new thing 😸. Thanks for sharing your knowledge and I love so much your passion for python
@ummnine6938
@ummnine6938 Жыл бұрын
its like watching some really high level fashion celeb teaching programming, i love this channel!
@PythonSimplified
@PythonSimplified Жыл бұрын
hahahaha wow! thank you so much! 😀😀😀
@edderleonardo
@edderleonardo Жыл бұрын
This is the best tutorial about list comprehension, we need the dictionary comprehension
@susanthomas223
@susanthomas223 11 ай бұрын
Liked the way you explained it step by step and in depth
@stan55ish
@stan55ish Жыл бұрын
'm very close to senior age I'm very thankful for your clear lessons
@williammonday9509
@williammonday9509 Жыл бұрын
Hi Mariya! Thank you for making the list comprehension tutorial. I was struggling with the concept.
@aswinkumar4452
@aswinkumar4452 Жыл бұрын
I recently automated some CSV processing using list comprehension to help out the support guys in my company. A cool feature to have for sure!!
@dollysiharath4205
@dollysiharath4205 Жыл бұрын
Thank you - you're awesome at teaching.
@ZigBehaviour
@ZigBehaviour Жыл бұрын
Very clean and concise presentation - quality takes time, this took some time!
@norm_olsen
@norm_olsen Жыл бұрын
Thanks for this video! I really enjoy your method of teaching! Clear, concise and to the point! Not related to list comprehensions, would it be possible to see your take on explaining Closures in a future episode?! In any case, just discovered your channel and subscribed!
@PythonSimplified
@PythonSimplified Жыл бұрын
Thank you so much Norman! 😃 It's the first ever closures request I get - but I think you're onto something 🙂 I've put it on my "to do" list, it could relate to an upcoming decorators tutorial 😉
@armoniapush8281
@armoniapush8281 7 ай бұрын
Thank you very much Mariya, you are a so great professor.
@A1NTT
@A1NTT 4 ай бұрын
You are awesome. Such a great teacher!
@MegaDonaldification
@MegaDonaldification 7 ай бұрын
Your style of teaching is tremendously calming to mind, inner members and easy to grasp cause you add the extra effort to breakdown each step with mutual inclusive perspicuous/crystal clear processes. You understand the wisdom of patience of endurance and self-control in increase and kindness of absolute words of hope and encouragement. I may be very old than but I must say I love you, meaning i cant stop being explicitly patient and kind with my words toward you. I got this idea of love and trust in 1 Corinthians 13: 4-8 with Heading or subheading of ''the way of love.'' You solved a serious problem I was having in my mind - i had sleepless nights for close to one week trying to solve the PE1 Tic Tac Toe game.
@nachiketlokhande9306
@nachiketlokhande9306 Жыл бұрын
Such a fantabulous teaching and teacher, very well done Maria
@vladyslavdotsenko1519
@vladyslavdotsenko1519 Жыл бұрын
Very useful and easy to learn. Thank You very much.
@pythondz7901
@pythondz7901 Жыл бұрын
Mariya I had to watch the video twice. Because the serenity of your beauty made me lose focus 😅🤗 Thank you very much Mariya for the great content
@tomknud
@tomknud Жыл бұрын
Beautiful Mariya, you're a great teacher!
@nodrogguod
@nodrogguod Жыл бұрын
Thanks Mariya, great video, easy to follow and apply.
@M.I.S
@M.I.S Жыл бұрын
you're teaching is very good! thanks
@joelkarie
@joelkarie Жыл бұрын
Great tutorial, super clear. I would love to see a Dictionary Comprehension video.
@laurentm6330
@laurentm6330 Жыл бұрын
Hi Maria, great tuto! Thanks from France!
@teclote
@teclote 3 ай бұрын
Very clear, thank you.
@mohammedhosen696
@mohammedhosen696 Жыл бұрын
Awesome and pretty useful. Thanks 👍
@kosmonautofficial296
@kosmonautofficial296 Жыл бұрын
Great video that string manipulation example was really good
@borneoviral6379
@borneoviral6379 Жыл бұрын
Thank you very much...it really change the way I code now. 👍👍👍
@PythonSimplified
@PythonSimplified Жыл бұрын
Yeyy! You're absolutley welcome! Enjoy! 😃😃😃
@chrishabgood8900
@chrishabgood8900 Ай бұрын
Thanks, for the tutorial, I am a ruby guy, but learning python. There is also the readability factor. sometimes doing the longer if else can be easier to interpret.
@Roman-kn7kt
@Roman-kn7kt Жыл бұрын
Hey, thank you so much for your videos! # in coding example 3 you can also use: # regular expression library "re" import re text = "PythonTutorialAndExercises" print(re.findall('[A-Z][^A-Z]*', text)) # output # ['Python', 'Tutorial', 'And', 'Exercises']
@thewu32
@thewu32 Жыл бұрын
Just waouhhh!!! Thx for the sharing. 🙏🏿🙏🏿🙏🏿
@joycebienheureux6892
@joycebienheureux6892 Жыл бұрын
You're just awesome, wanna learn more from you. The explanation is really clear as a Cristal
@jasonappiatumusic6955
@jasonappiatumusic6955 Жыл бұрын
Wow, very great explanation, thank you for the video
@chessketeer
@chessketeer 8 ай бұрын
Thank you! You are a very good teacher👍
@V.Z.69
@V.Z.69 Жыл бұрын
List comprehension? Have you ever programmed in "Native C"? In C, we can create a "*.h" file and create definitions (header file)... It's very in depth. In short, you can create a "stub" for a "call function" or "call method" to shorten lines of code; rather than inserting popular function algorithms in each project. Even shorter, after building a "comprehensive list" of every-day functions you can just call the "function stub" (we say in C) and pass parameters and get the expected results (usually passing-by-reference to get a shorter and more expected result). Sounds like that's what Python is doing here. It's always good to know what's going on in the background. Great video!
@StudiofrogPl
@StudiofrogPl Жыл бұрын
Ania masz niesamowity zmysł do uczenia, tłumaczenia i wyjaśniania. Widzę też ukryty talent aktorski ;)
@Owen7768
@Owen7768 8 ай бұрын
Thank you! very helpful explanation
@ort1340
@ort1340 Жыл бұрын
Thank you so much 💖 ♥️ Great video 👏 😀
@sadiqurrahman2
@sadiqurrahman2 Жыл бұрын
Awesome. I request you for more videos on Python in this authentic method.
@kevinhernandez6142
@kevinhernandez6142 Жыл бұрын
I really like the energy and positivity you transmit when teaching very usefull and interesting info. Kepping up María n.n Banananame XD
@mchess7157
@mchess7157 Жыл бұрын
I've never come up with an idea to use list comprehension to manipulate strings. Nice and useful. As well as the way to use elif statement 👏
@PythonSimplified
@PythonSimplified Жыл бұрын
For a long time I've been manipulating strings with Regex or NLTK, so I really love the fact that you don't need to import any libraries to achieve similar results 😉I don't know if it's a better alternative, but I have a feeling it's worth testing it! 😊
@JavierIracheta
@JavierIracheta Жыл бұрын
thank you, it was a very useful tutorial for me!!
@alfblack2
@alfblack2 Жыл бұрын
OMG! I have been struggling with this for a long time. And having a hard time to find documentation. Thank you teacher!! Teacher banana is looking extra pretty today. hehehe
@lain_iwakura_ir1684
@lain_iwakura_ir1684 Жыл бұрын
Thing I really like how you excited about what you interest in
@christopherb2246
@christopherb2246 Жыл бұрын
It’s like she is Teacher kindergarten kids. It works for me.
@joedansilvasantos3710
@joedansilvasantos3710 Жыл бұрын
Beautiful! Awesome!
@undeadpresident
@undeadpresident Жыл бұрын
I just learned how to do for loops and this looks like a perfect next step. Yes I'd like to learn things with dictionaries too. I actually just made a little program that types back the keystrokes that you type into it with the same time intervals between keystrokes, so it types it back just like you typed it, and had to loop using both a list and dictionary to do it.
@PythonSimplified
@PythonSimplified Жыл бұрын
That's awesome, undeadpresident! 😀 Sounds like a great way to add human features to bots - typing in random intervals to avoid detection (or pre-recorded in your case) Oh, and - Dictionary comprehensions tutorial is officially coming soon! 😉
@undeadpresident
@undeadpresident Жыл бұрын
@@PythonSimplified lol that wasn't exactly the idea I had in mind to use it for, but now that you mention it.....mwhahahahaaa!
@sergemmol5357
@sergemmol5357 Жыл бұрын
Damn, one of the best explained tutorial I've ever seen
@andresfrancojunor
@andresfrancojunor Жыл бұрын
Thanks great & useful explanation as usual !!
@offey2055
@offey2055 Жыл бұрын
Needed that thanks Mariya😁
@joelsstuff8318
@joelsstuff8318 Жыл бұрын
You’re hair was covering your maple leaves. So I didn’t get the “team eh” for a while. Funny. And nice graphics. Well done.
@Nuohis13
@Nuohis13 Жыл бұрын
Good examples and visualizations.
@aasifkhan1545
@aasifkhan1545 Жыл бұрын
This video really helps me a lot Thanks, I am really really curious about how dictionary comprehension , I'll be waiting for part 2
@PythonSimplified
@PythonSimplified Жыл бұрын
Thank you so much Aasif! 😁 Dictionary comprehensions tutorial is coming soon!
Software Design and Development - What I Learned So Far - Exam Practice
1:44:06
Dictionary Comprehension - Create Complex Data Structures Step by Step
21:58
Василиса наняла личного массажиста 😂 #shorts
00:22
Денис Кукояка
Рет қаралды 6 МЛН
IS THIS REAL FOOD OR NOT?🤔 PIKACHU AND SONIC CONFUSE THE CAT! 😺🍫
00:41
1🥺🎉 #thankyou
00:29
はじめしゃちょー(hajime)
Рет қаралды 84 МЛН
10 Python Comprehensions You SHOULD Be Using
21:35
Tech With Tim
Рет қаралды 114 М.
If __name__ == "__main__" for Python Developers
8:47
Python Simplified
Рет қаралды 379 М.
11 Tips And Tricks To Write Better Python Code
11:00
Patrick Loeber
Рет қаралды 601 М.
Python List Comprehensions Made Easy!!
11:50
Travis Media
Рет қаралды 13 М.
Python Classes and Objects - OOP for Beginners
8:01
Python Simplified
Рет қаралды 532 М.
Python lists, sets, and tuples explained 🍍
15:06
Bro Code
Рет қаралды 230 М.
PLEASE Use These 5 Python Decorators
20:12
Tech With Tim
Рет қаралды 95 М.
Python Learning Roadmap for Beginners - This is how I learned! - Vlog 4
6:47
5 Good Python Habits
17:35
Indently
Рет қаралды 369 М.
wireless switch without wires part 6
0:49
DailyTech
Рет қаралды 3,9 МЛН
Mi primera placa con dios
0:12
Eyal mewing
Рет қаралды 719 М.
Дени против умной колонки😁
0:40
Deni & Mani
Рет қаралды 12 МЛН
МОЩНЕЕ ТВОЕГО ПК - iPad Pro M4 (feat. Brickspacer)
28:01
ЗЕ МАККЕРС
Рет қаралды 77 М.