In the DNA example, to simplify the code, I would create a dictionary: pair = {"A":"T", "C":"G", "G":"C", "T":"A"} Then, instead of the nested if statements, do dna = {key:[val, pair[val]] for (key, val) in enumerate(strand1)}
@JorgeEscobarMX
2 жыл бұрын
Agree, I felt a little excesive use of ternerary operatrors.
@colsadventures
2 жыл бұрын
I think it should be .. pair[val]] .. but could be wrong.
@katbryce
2 жыл бұрын
@@colsadventures Yes it should, I've edited it now. 😳
@PythonSimplified
2 жыл бұрын
Wow!! This looks awesome Katrina!! Great job! I love it! 😃😃😃
@aldolunabueno2634
Жыл бұрын
I've done it in a similar way: dna = {idx:[b, {'A':'T', 'T':'A', 'C':'G', 'G':'C'}[b]] for (idx, b) in enumerate(strand1)}
@owoled282
2 жыл бұрын
The level of polish of the channel in general is really appreciated , thanks for sharing your knowledge !
@victorj.alonzo
2 жыл бұрын
"Let's say that Spiderman is not exactly welcome in this DC dictionary" haha that was funny. I loved the examples.
@PythonSimplified
2 жыл бұрын
hahahaha glad you like my humor Victor! thank you! 😃
@factotums
29 күн бұрын
@@PythonSimplified I concur. Using pop culture references not only makes things less tedious, but it really helps with comprehension. That's why this is my favorite coding channel. So many tutorials are just a monotonous voice on a bad mic with a screen recording of their IDE. Also just wanted to say you're a really good teacher.
@tortugatortuga7505
2 жыл бұрын
I'm using this to teach a student about dictionaries, thank you!
@josueporrasguajard7736
5 ай бұрын
Excellent work! The clarity and didactics with which you have explained each concept are impressive. You have managed to break down complex topics into simple and accessible explanations, which is essential for deep understanding. Your ability to maintain simplicity without losing the essence of the concepts is truly admirable. Keep it up! Congratulations..
@GOTHICforLIFE1
2 жыл бұрын
I feel like dictionary comprehensions lose a little bit of its readability compared to a conventional loop once you start applying multiple conditions. Especially with group else statements rather than the traditional elif which (as you mentioned) doesn't exists within the comprehension. But really nice to know about the feature as it never occurred to me that this existed.
@PythonSimplified
2 жыл бұрын
I absolutely agree! I find that Comprehensions are much more comprehendible with lists hahahaha when it comes to dictionaries - the syntax becomes un-Pythonic very fast 😅 With that said, I use it way more often than traditional loops. I think I trained my brain to actually find it intuitive 🙃 hahahaha
@Sinke_100
2 жыл бұрын
@@PythonSimplified even if it looks less redable, i so much enjoy using a comprehenssion of everything, agree with you [x:=str(i)+str(i)[-1] for i in range(0,20,10)][1]+'%' 🙂
@sachindeshpande1
Жыл бұрын
First time it was overwhelming for me, but second time it was fun and I could understand it 100%. I need to implement this in real project before I forget it, Thanks a lot.
@MrDie97crew
2 жыл бұрын
Great video, it is too clear. A little variation of your code for the exercise #3: users = ["mariyasha888", "KnotABot", "SpongiBOBO", "IAMBATMAN"] keys = { "id": lambda id: id, "username": lambda username: users[username], "password": lambda passw: "".join(random.choices(string.printable, k=8)) } data = [{key:(val(i)) for (key,val) in keys.items()} for i in range(len(users))] Maybe it's not the best way to do it, but it's just for practice 🙃. I'm learning python 😅. and your videos are very useful!!!
@francismannion7075
3 ай бұрын
Wow that was great ,thank you..
@diwakar_tsn
2 жыл бұрын
Hey Mariya This video will help many💙🙃❤️
@isojama1
2 жыл бұрын
Thank you for this really good video. Definetly the last example was "WOW. I wouldnt be able to do it". Nice !!!!
@PythonSimplified
2 жыл бұрын
Yeyyy!!! Super happy you liked it Danail! 😃😃😃
@patricioa5535
2 жыл бұрын
This was a really good tutorial showing more uses for comprehensions. Thanks! Also, the addition of the slides showing the important notes was a really good add. That was very welcome. Thanks again!
@PythonSimplified
2 жыл бұрын
Thank you so much for the incredible feedback, Patricio! Super happy you enjoyed this tutorial! 😃😃😃
@tomislam
2 жыл бұрын
The 'key' to learn dictionary comprehension is to practice this 'value'able exercises in this video.
@PythonSimplified
2 жыл бұрын
hahahaha that was very poetic, Tom!! 😁
@tomislam
2 жыл бұрын
@@PythonSimplified Thank You 😊
@wu1484741111
5 ай бұрын
This real makes fun with dictionary comprehension for doing own private project
@milo_andrs
5 ай бұрын
Love the examples, thank you
@Thebytedoc69
6 ай бұрын
Mariya, Thank You for your very informative and energetic videos. Your videos are excellent and flow so well. Keep up the great work.
@_isDev
Жыл бұрын
Amo a esta mujer! Enseña muy bien!
@manoharsagunthalla9215
4 ай бұрын
Tank you very much for the video . YOur explanations are awesome
@rst2205
2 жыл бұрын
Requesting for a data structures and algorithm playlist
@PythonSimplified
2 жыл бұрын
Will do! I'm waiting to finish my current Algorithms and DS 2 module in university before I can properly cover the topic 😉 (My final exam is in September, so not much longer to wait 😊)
@rst2205
2 жыл бұрын
@@PythonSimplified All the best for your exams mam!!
@realmadwolf
2 жыл бұрын
@@PythonSimplified Great, And all the best for your exams tho you gonna score 10/10 anyways
@Zub1Wun
3 ай бұрын
Thank you for this video Mariya, it's really helped me in my journey
@adrianrayon2834
Жыл бұрын
lists/dicts comprehension are constantly on that line where they are either great and easy to make and read or just long and ugly and make it harder to read so sometimes they are great, but sometimes it´s just better to do normal for loops
@rgAlex8386
9 ай бұрын
The most complete tutorial on DC. Can you please sware more on that
@suvimpemel5583
2 жыл бұрын
As always the examples you choose are always related to my use cases. Thanks a lot for the supper intuitive video.
@PythonSimplified
2 жыл бұрын
That's awesome!!! Super happy I could telepathically guess the most useful examples! 😁😁😁
@Sol_Naif
Жыл бұрын
A million thanks Maria, your explanation is very good
@davidpimental6704
Жыл бұрын
Mariya, you can turn the password generator into a function call. And I also added a UID function as well. Great tutorial though. Thanks so much!
@kostas6915
2 жыл бұрын
Excellent material and excellent educational exposition! Very well done!
@martella13
Жыл бұрын
I'm a Mariya simp :) :) lol your videos are an excellent supplement to my college courses! Thank you for all your hard work!
@gregap8282
2 жыл бұрын
This might be the best python tutorial I've ever found online. Thanks for sharing.
@_mrmark
2 жыл бұрын
Maria, thanks for the lessons. Almost everything is clear and without translation. zip is faster
@manoharsagunthalla9215
4 ай бұрын
It’s really awesome thank you for the video
@dogustabiyat
Жыл бұрын
Very Useful Thanks!
@takeshih.1349
2 жыл бұрын
My intuition tells me that range approach is faster, because zip approach must contain the procedure to compare between names and profs. Im a newbie for Python programming. Thank you for your videos, that help me a lot to learn Python.
@PythonSimplified
2 жыл бұрын
Thank you so much for your comment Takeshi! 😃 I'm planning a live stream in which we will compare the two approaches! my intuition also tells me range() - however, with Python 3, the zip() approach is also very efficient so I'm expecting a very close battle 😉
@optimus888amicus
Жыл бұрын
Hi, Sunshine ! 🌞😉👌 Very good !
@danadasachan7208
Жыл бұрын
Thank you Mariya. I found this very helpful and easy to understand.
@baylonyap1113
Жыл бұрын
Super Enjoyed and Laughing !! 😀😀😀
@varunkaniyala6302
Жыл бұрын
I became mad after watching this video. But you are a great tutor. I became a fan of you. Love you and your English. Thank you so much🧐😵💫🤒. I request you to please start a complete python tutorial for beginners.
@jeffersonbrunheira6160
Жыл бұрын
Thanks a lot! This content is very important for advanced python learn. 😃
@PythonSimplified
Жыл бұрын
Thank you so much Jefferson! I'm glad you found it useful! 😊
@frenamakenson9844
8 ай бұрын
amazing tips, thx for sharing !
@plurisdesign3210
Жыл бұрын
Best tutorial ever
@dagmite
Жыл бұрын
Just helped me tackle my dictionary mental block.. Good stuff!
@bejinbejin2744
Жыл бұрын
your all videos are very very useful 👍
@manoharsagunthalla9215
4 ай бұрын
Will you please explain in separate video about how to read multiple elements from user at time using split function . 2. How to sort a dictionary without converting to tulle
@Kazner0h
Жыл бұрын
You are such a skilled teacher! Thank you
@kieutrungtran1549
Жыл бұрын
You are a great teacher. Smart and beautiful
@Owen7768
Жыл бұрын
your explanation is very clear, thank you!
@kris_programmer
2 жыл бұрын
Love the examples. Awesome content!
@oguzturkyilmaz543
2 жыл бұрын
Thanks
@greisboy425
2 жыл бұрын
If it's just a simple code, go and use list/dict comprehension, but when you logic become more complex, you better write it the old way, it's lot easier to read. Just like lambda for simple function and not for complex function.
@sbel177
2 жыл бұрын
I just discovered your channel and I've enjoyed following along with you. You are a great teacher! Thank you for all your hard work :)
@guimoncao
2 жыл бұрын
I'm not a Python programmer, but I like your videos
@PythonSimplified
2 жыл бұрын
Thank you so much Guilherme!! 😃 I might end up convincing you to start using Python... I have some really exciting projects in the making 😉
@guimoncao
2 жыл бұрын
@@PythonSimplified Maybe I can use it in my projects too
@OneMilian
2 жыл бұрын
Thank you so much!!!!
@chessketeer
Жыл бұрын
Great teaching! Thank you!
@mrpeace422
Жыл бұрын
Thanks a lot ! ❤❤. I was learned something from you. You are also better than my python profesor . U r taught something to me recent days . U r way speech and teaching is amazing itz easy to understand (but some topics are tough ) although u r videos are great 🥰
@rahulkmail
2 жыл бұрын
Excellent.
@davidsonfong9549
2 жыл бұрын
love your channel. Thank you for simplifying such valuable knowledge! Your delivery is on point.
@jeuxmathinfo9578
Жыл бұрын
Very useful ! 🏆🏆🏆🏅🏅🏅Thank you very much !!! 🙏🤗
@cdxc_55uh
Жыл бұрын
Wow, what a nice KZitem channel. Nice to see you, Mariya!
@kaisj7
2 жыл бұрын
Nice Video THX , I just begin study dictionary
@PythonSimplified
2 жыл бұрын
Awesome timing then! 😉 Best of luck with studying, Kais! 😃
@kaisj7
2 жыл бұрын
@@PythonSimplified I try my best I very like Python and I love to learn it and U help me really 😄
@nayanjadhav7841
Жыл бұрын
Wonderful video.
@hasanbaaqeil42
Жыл бұрын
beautiful... thanks.. .. I like your extra efforts to make these videos enjoyable with nice editing and awsome graphics
@flioink
2 жыл бұрын
I'd expect the "zip" method to be the faster one because it was purpose-made for such cases and probably has some built-in optimizations, no? Also the list comprehension where we add "man" works without putting (key, val) in brackets.
@goldie2799
2 жыл бұрын
Realy good video thanks a lot !
@hugocesarescajeda5728
2 жыл бұрын
Cheers from México 💋
@Mr_Dean77
Жыл бұрын
I feel the comprehension with the range function is faster🙃🙃.. cos range functions has less work load to perform than the Zip method.🤔
@easydatascience2508
Жыл бұрын
You can watch y playlists for Python and R, welcome !
@dimitriosdesmos4699
2 жыл бұрын
very good very clever, very helpful.....but i rarely use these comprehensions and it would be faster for me to do it the long way than sit down to memorise the rules...then forget them.
@BTM-p
2 жыл бұрын
Wow, thanks dear
@jongcheulkim7284
Жыл бұрын
Thank you^^ This is very helpful.
@TechieGuy82
2 жыл бұрын
Lovely as always Mariya. I would like to point out that using the random module isn't safe for generating passwords. People might use it to generate passwords for their various accounts online. You could mention the secrets module which is advised and secure. Anyway keep up the good work. Love you ❤️
@PythonSimplified
2 жыл бұрын
Thank you so much for the awesome tip, TechieGuy! 😃 Secrets is indeed much more randomized than Random! the only issue is - I couldn't find a secrets.choices() method but rather secrets.choice() which returns a single value instead of k of them. From my perspective, the last exercise seemed convoluted enough to avoid the additional list comprehension of: password = "".join([secrets.choice(string.printable) for i in range(8)]) That's why I went for Random instead... however - if this was a dedicated video for random passwords I'd definitely use Secrets instead 😉
@taylormccoy7492
Жыл бұрын
I think it would probably be faster to use the zip method. Two primary reasons, one being that with the range approach you have to check the list on each iteration, and two being since the zip function was probably programmed to do this efficiently it has a different method of accessing the objects. Just my guess!
@jamvin5647
Жыл бұрын
3:15 I think the zip approach is faster because the syntax is more comprehensive
@niftyquizforfun6324
2 жыл бұрын
hello i m from indian yours warm well come i saw yours python video are very great i want learn python i think always may be one day i will learn python but money fees problem but my dream that learn python bcoz i saw python code is so lovely and easy for write and understand yes sue we can do with python code many great thing so my simple and hamble request from you can you teach to me python step by step from beginning thanq
@papinpython6103
2 жыл бұрын
Trop forte cette merveilleuse dame
@aasifkhan1545
2 жыл бұрын
I think the range approach is fastest.
@codewithbheem
2 жыл бұрын
Happy teacher day mam
@georgeorwell2334
2 жыл бұрын
NIce to see again - greets from Germany.
@PythonSimplified
2 жыл бұрын
Thank you so much George Orwell! Huge fan of your 1984 book 😉 hahaha Greetings from Vancouver! 😃
@tomknud
2 жыл бұрын
Indeed your best! ♥
@devvsakib5223
2 жыл бұрын
Great!
@neilmeich
12 күн бұрын
thank u
@QuarktaschemitSenf
11 ай бұрын
1:07 why not use the dict constructor here instead of the loop? dict_names_professions = dict(zip(list_names, list_professions)) any differences , benefits from using the loop?
@semlion4972
2 жыл бұрын
Thanks for another video if you can in the future make python with MySQL some mini project tnx. 😀
@PythonSimplified
2 жыл бұрын
Hi Sem 😃 MySQL is definitely on my to-do list! will cover it in my Linux machine in future tutorials. In the meanwhile, you can checkout my SQLite tutorials: ⭐ SQLite Backend for Beginners: kzitem.info/news/bejne/sJ6gk3enen6jqqA (please note - the above tutorial is missing connection.commit()) ⭐Web Scraping Databases with Mechanical Soup and Sqlite: kzitem.info/news/bejne/rqF9t6GQqH-mhYI (includes connection.commit() which is very important!) It's not exactly MySQL, but it's right off the same alley 😉
@jackroark6928
2 жыл бұрын
🍓⭐high quality
@ChristopherBruns-o7o
Ай бұрын
the one using range because type(int) and expanding python with c,
@QuarktaschemitSenf
11 ай бұрын
10:23 shouldnt it be "strand1" inside the () brackets instead of dna_st1 ? sorry im easy to confuse xD. Also in the last line of the for-loop it should be b2 = "C" otherwise you can pair A with G
@kom_senapati
2 жыл бұрын
Another solution to the list of dicts problems: import random as r from string import printable as p from pprint import pprint users = ["Hanzo","Peter","Brian"] keys = ["id","user","password"] pprint([dict( id = i, user = user, password = "".join(r.choices(p,k=9)) ) for i,user in enumerate(users)])
@shinrafahell
2 жыл бұрын
Thank you beautiful smart lady!
@sakethkesari189
10 ай бұрын
Can you make tutorials like this numpy, pandas and tensorflow
@guenzizabdelaziz5185
2 жыл бұрын
Hi Mariya I like your KZitem channel for Python
@Yachid
2 жыл бұрын
Hey Mariya~!
@yoyocswpg
5 ай бұрын
I don't think readability would hurt cuz this kind of code normally hides behind some sort abstraction, such as a well-named function, so everybody just knows that it works
@Sinke_100
2 жыл бұрын
from random import choices as c pair1, pair2 = list('AT'), list('CG') bases1, bases2 = pair1+pair2, pair1[::-1]+pair2[::-1] strand = c(bases1, k=10) dna = {key:[val, bases2[bases1.index(val)]] for key, val in enumerate(strand)} print(dna) This aproach imidiatly comed to my mind Mariya, I really enjoyed a video btw 🙂 P.S. have you ever tryed pydroid? It's an ide on android
@PythonSimplified
2 жыл бұрын
Niiiiice!! Thank you for the awesome input Sinisa! 🤩🤩🤩 I'm super happy to see so many different variations of this code! The more - the marrier! 😃 (I think you might also like Katrina's approach from the pinned comment, check it out when you have a chance 😊)
@PythonSimplified
2 жыл бұрын
I haven't had a chance to try pydroid yet, but if you recommend it - I'm gonna give it a shot! 😉
@Sinke_100
2 жыл бұрын
@@PythonSimplified yes, i saw her aproach it's better i agree, this is my take it's fine enough i gues, yes i use pydroid for more than a year, usually people are a bit skeptical about it, using python on phone, but with combination of microsoft swift keyboard it's really nice to use it, and you have your phone always with you, so it's convinient
@kom_senapati
2 жыл бұрын
I want to solve some more such problems. Do you know where can I get that?
@sudhansumtripathy
Жыл бұрын
really got stuck how we can put multiple values in the value ie [ value, if statemen], if you could further elaborate
@Punda_Man
Жыл бұрын
Who's song is playing on the background. It's nice
@RealRadaiZabala
10 ай бұрын
Hey Mariya, can you do a tutorial using Dictionaries for a Customer List program using the terminal? @Python Simplified
@MrPioneer7
2 жыл бұрын
About your question, I think zip method should be faster 🌹
@sanjaymishra-ec9lw
2 жыл бұрын
Mam, I want to create a android application. Can I create with Tkinter Or Kivy framework?
@PythonSimplified
2 жыл бұрын
With Kivy - you sure can! I even have a bunch of tutorials with specific instructions for Android: ⭐ Create a Mobile App with KivyMD: kzitem.info/news/bejne/wp5psJl-eph-Y4I ⭐ Convert Python App to Android App with Windows and KivyMD: kzitem.info/news/bejne/t6mKx4Fmbmmjl5g I also have a Kivy tutorial which can also be converted to Android (very similar instructions to the above app, KivyMD is just a stylized version of Kivy) ⭐Simple Python App with Kivy: kzitem.info/news/bejne/unqmnWeNo4B6hpg Tkinter, however, is a desktop GUI which works great across different operating systems, however - I'm not aware of any Android integrations. I have a very nice tutorial for it, but I don't see how it cab result in a mobile app: ⭐Create GUI App with Tkinter and SQLite: kzitem.info/news/bejne/lqeF1K58cISkgXY Good luck with your project and I hope my reply was helpful! 😁
@ivankuz1316
Жыл бұрын
Cool
@Sup3rdud4
2 жыл бұрын
I think the zip is faster because for loops are 🐌
@PythonSimplified
2 жыл бұрын
We'll test the benchmarks of the two approaches in an upcoming live stream, I'm cheering for range() but zip() is also incredibly efficient - it's gonna be a very close battle, that's for sure! 😉
@tofie3852
11 ай бұрын
Hi Mariya, I can't open the code page!!!! Thanks
@Serhii_Hrechka
2 жыл бұрын
Please write in what program you created the animation in the first minutes of the video. Thank you.
@PythonSimplified
2 жыл бұрын
I Serhii! 😃 I use Adobe Premiere for the animations and Adobe Illustrator to design the frames 😊
Пікірлер: 230