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)}
@@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.
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..
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.
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
@@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]+'%' 🙂
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!
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.
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!!!
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?
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.
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 😉
Thank you so much for your comment David! We will compare zip() and range() in an upcoming live stream, we'll see exactly which of them beats the other 😉
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
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.
That was my original plan, Dimitri! 😃but then I thought to myself - what's the problem with spaces? I couldn't find a single reason why they would be any different from the rest of the characters 🤷♀️ Some sites do prevent you from using spaces within passwords - but I don't think it's based on merit. Do you find that space-less passwords are more secure?
Because string.printable contains whitespace \t, , , at first i used to cut it at the end when i imported it, but for me better aproach was change the original string module and create printable_ww same but without white space, i would like to contribute to open source to change that for python 3.12 if comunity accepts it
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 😊)
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 🥰
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.
can you have multiple keys for the same value in a dictionary? say if i wanted to make a dictionary of all ages in my family tree alive/dead and if some of them have the same age. Great video i am just learning dictionaries in cs50 and watched this video. Thank you!
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
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.
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
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!
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.
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
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: th-cam.com/video/Ohj-CqALrwk/w-d-xo.html (please note - the above tutorial is missing connection.commit()) ⭐Web Scraping Databases with Mechanical Soup and Sqlite: th-cam.com/video/MkGQmZoMuRM/w-d-xo.html (includes connection.commit() which is very important!) It's not exactly MySQL, but it's right off the same alley 😉
With Kivy - you sure can! I even have a bunch of tutorials with specific instructions for Android: ⭐ Create a Mobile App with KivyMD: th-cam.com/video/ah3JeHAfM0M/w-d-xo.html ⭐ Convert Python App to Android App with Windows and KivyMD: th-cam.com/video/VsTaM057rdc/w-d-xo.html 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: th-cam.com/video/YDp73WjNISc/w-d-xo.html 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: th-cam.com/video/5qOnzF7RsNA/w-d-xo.html Good luck with your project and I hope my reply was helpful! 😁
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)])
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)}
Agree, I felt a little excesive use of ternerary operatrors.
I think it should be .. pair[val]] .. but could be wrong.
@@colsadventures Yes it should, I've edited it now. 😳
Wow!! This looks awesome Katrina!! Great job! I love it! 😃😃😃
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)}
The level of polish of the channel in general is really appreciated , thanks for sharing your knowledge !
"Let's say that Spiderman is not exactly welcome in this DC dictionary" haha that was funny. I loved the examples.
hahahaha glad you like my humor Victor! thank you! 😃
@@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.
The 'key' to learn dictionary comprehension is to practice this 'value'able exercises in this video.
hahahaha that was very poetic, Tom!! 😁
@@PythonSimplified Thank You 😊
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..
I'm using this to teach a student about dictionaries, thank you!
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.
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
@@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]+'%' 🙂
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!
Thank you so much for the incredible feedback, Patricio! Super happy you enjoyed this tutorial! 😃😃😃
Mariya, Thank You for your very informative and energetic videos. Your videos are excellent and flow so well. Keep up the great work.
Many thanks for the great content. This should be archived for future data analysts and pythonistas.
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.
Thank you for this really good video. Definetly the last example was "WOW. I wouldnt be able to do it". Nice !!!!
Yeyyy!!! Super happy you liked it Danail! 😃😃😃
Amo a esta mujer! Enseña muy bien!
Excellent material and excellent educational exposition! Very well done!
As always the examples you choose are always related to my use cases.
Thanks a lot for the supper intuitive video.
That's awesome!!! Super happy I could telepathically guess the most useful examples! 😁😁😁
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!!!
Very well explained! I like your videos. They help me better understand the Python language. Keep up the good work. 👍🙏
Thanks. Great video! I haven’t used dictionaries much yet, but I’ll come back to this when I do.
Thank you, Tim! 😃
A million thanks Maria, your explanation is very good
Thank you Mariya. I found this very helpful and easy to understand.
Love the examples. Awesome content!
Just helped me tackle my dictionary mental block.. Good stuff!
Amazing! was looking forward to this video!! thank you thank you!!
I'm a Mariya simp :) :) lol your videos are an excellent supplement to my college courses! Thank you for all your hard work!
love your channel. Thank you for simplifying such valuable knowledge! Your delivery is on point.
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?
Hey Mariya
This video will help many💙🙃❤️
Great teaching! Thank you!
Tank you very much for the video . YOur explanations are awesome
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!
The most complete tutorial on DC. Can you please sware more on that
Thank you for this video Mariya, it's really helped me in my journey
your explanation is very clear, thank you!
You are such a skilled teacher! Thank you
This might be the best python tutorial I've ever found online. Thanks for sharing.
Wow, what a nice TH-cam channel. Nice to see you, Mariya!
your all videos are very very useful 👍
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 :)
I needed this video! Thank you stay awesome!
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.
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 😉
Maria, thanks for the lessons. Almost everything is clear and without translation. zip is faster
great video!! thank you. You're a super teacher about python, it's easy with you!! . 3:15 I Think zip is faster than len
Thank you so much for your comment David! We will compare zip() and range() in an upcoming live stream, we'll see exactly which of them beats the other 😉
beautiful... thanks.. .. I like your extra efforts to make these videos enjoyable with nice editing and awsome graphics
Great tutorial I like very much. Thank you Mariya
Love the examples, thank you
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
Wow that was great ,thank you..
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.
You are a great teacher. Smart and beautiful
Thanks a lot! This content is very important for advanced python learn. 😃
Thank you so much Jefferson! I'm glad you found it useful! 😊
Super Enjoyed and Laughing !! 😀😀😀
It’s really awesome thank you for the video
This real makes fun with dictionary comprehension for doing own private project
Awesome video, I've learnt a lot!! Thank you so much
Password generation code (in my tests) may produce a string with one or more spaces. Used replace to get rid of those.
That was my original plan, Dimitri! 😃but then I thought to myself - what's the problem with spaces? I couldn't find a single reason why they would be any different from the rest of the characters 🤷♀️
Some sites do prevent you from using spaces within passwords - but I don't think it's based on merit. Do you find that space-less passwords are more secure?
Because string.printable contains whitespace \t,
,
, at first i used to cut it at the end when i imported it, but for me better aproach was change the original string module and create printable_ww same but without white space, i would like to contribute to open source to change that for python 3.12 if comunity accepts it
This was an awesome tutorial 👍👍👍
Requesting for a data structures and algorithm playlist
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 😊)
@@PythonSimplified All the best for your exams mam!!
@@PythonSimplified Great, And all the best for your exams tho you gonna score 10/10 anyways
Very useful ! 🏆🏆🏆🏅🏅🏅Thank you very much !!! 🙏🤗
Very Useful Thanks!
Hi, Sunshine ! 🌞😉👌
Very good !
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 🥰
3:15 I think the zip approach is faster because the syntax is more comprehensive
Nice Video THX , I just begin study dictionary
Awesome timing then! 😉
Best of luck with studying, Kais! 😃
@@PythonSimplified I try my best I very like Python and I love to learn it and U help me really 😄
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.
Best tutorial ever
Indeed your best! ♥
Thank you^^ This is very helpful.
Thanks for your tutorial, where can I get the code for your tutorial?
can you have multiple keys for the same value in a dictionary? say if i wanted to make a dictionary of all ages in my family tree alive/dead and if some of them have the same age. Great video i am just learning dictionaries in cs50 and watched this video. Thank you!
Thanks for your tutorial, where can I get the code for your tutorial?😁
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
amazing tips, thx for sharing !
Realy good video thanks a lot !
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.
12:55did u just said "neta" ?? xD awesome tutorial!
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
Thank you so much!!!!
I'm not a Python programmer, but I like your videos
Thank you so much Guilherme!! 😃 I might end up convincing you to start using Python... I have some really exciting projects in the making 😉
@@PythonSimplified Maybe I can use it in my projects too
Wow, thanks dear
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!
NIce to see again - greets from Germany.
Thank you so much George Orwell! Huge fan of your 1984 book 😉 hahaha
Greetings from Vancouver! 😃
Love it!!!!!!!!!!!!!!!
This is great. Thanks.
Cheers from México 💋
I feel the comprehension with the range function is faster🙃🙃.. cos range functions has less work load to perform than the Zip method.🤔
You can watch y playlists for Python and R, welcome !
..great job Mariya. )) Which university did you attend that you reference at times? Do you teach somewhere? Again thanks. )))
Trop forte cette merveilleuse dame
Second comment...
Great Video..
Thank you so much Rafael! 😊
@@PythonSimplified Rafael?
Wonderful video.
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.
Super👍🏻💕
Do you give one on one personal tutor sessions?
Excellent.
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
Hey Mariya~!
Who's song is playing on the background.
It's nice
Thanks for another video if you can in the future make python with MySQL some mini project tnx. 😀
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:
th-cam.com/video/Ohj-CqALrwk/w-d-xo.html
(please note - the above tutorial is missing connection.commit())
⭐Web Scraping Databases with Mechanical Soup and Sqlite:
th-cam.com/video/MkGQmZoMuRM/w-d-xo.html
(includes connection.commit() which is very important!)
It's not exactly MySQL, but it's right off the same alley 😉
Mam, I want to create a android application. Can I create with Tkinter
Or Kivy framework?
With Kivy - you sure can! I even have a bunch of tutorials with specific instructions for Android:
⭐ Create a Mobile App with KivyMD:
th-cam.com/video/ah3JeHAfM0M/w-d-xo.html
⭐ Convert Python App to Android App with Windows and KivyMD:
th-cam.com/video/VsTaM057rdc/w-d-xo.html
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:
th-cam.com/video/YDp73WjNISc/w-d-xo.html
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:
th-cam.com/video/5qOnzF7RsNA/w-d-xo.html
Good luck with your project and I hope my reply was helpful! 😁
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)])
Please write in what program you created the animation in the first minutes of the video. Thank you.
I Serhii! 😃
I use Adobe Premiere for the animations and Adobe Illustrator to design the frames 😊