10 ULTIMATE Python Tips 🔥

  Рет қаралды 63,883

Tech With Tim

Tech With Tim

Күн бұрын

In today's video, I'll share with you 10 simple, practical, and extremely useful Python features that every Python developer should know! These features will save you time, make your code more readable, and can be learned in under 60 seconds. Learn to code more effectively today!!
Become a software engineer with affordable and effective with my programming course, Programming Expert: www.programmingexpert.io/product
- Use discount code "tim"
💻 Master Blockchain and Web 3.0 development today by using BlockchainExpert: 🔗 algoexpert.io/blockchain (Use code "tim" for a discount!)
💻 Accelerate your software engineering career with ProgrammingExpert: 🔗 programmingexpert.io/tim (Use code "tim" for a discount!)
🎬 Timestamps ⏱️
00:00 | Python Tips
01:05 | Python "_"
02:51 | lambda
05:00 | zip()
06:49 | .get()
08:06 | .setdefault()
09:52 | print()
11:57 | Negative Indexing
12:58 | For Else & While Else
14:05 | In-Line Swaps
15:10 | Ternary Operator
◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️
👕 Merchandise: 🔗 teespring.com/stores/tech-wit...
📸 Instagram: 🔗 / tech_with_tim
📱 Twitter: 🔗 / techwithtimm
🔊 Discord: 🔗 / discord
📝 LinkedIn: 🔗 / tim-ruscica-82631b179
🌎 Website: 🔗 techwithtim.net
📂 GitHub: 🔗 github.com/techwithtim
One-Time Donations: 💲 www.paypal.com/donate?hosted_...
Patreon: 💲 / techwithtim
◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️
⭐️ Tags ⭐️
-Tech with Tim
-Python
-Programming
⭐️ Hashtags ⭐️
#programming #coding #python

Пікірлер: 89
@TechWithTim
@TechWithTim Жыл бұрын
What are your best Python tips?!
@kingofcastlechaos
@kingofcastlechaos Жыл бұрын
while True: watch Tech_with_Tim practice, practice, practice! print('Thank you Tim!!')
@Vancha112
@Vancha112 Жыл бұрын
​@@kingofcastlechaoswhy do you never thank him 😭
@kingofcastlechaos
@kingofcastlechaos Жыл бұрын
@@Vancha112 to be honest I had to pee and rushed the code. Now it's just funny. Thank you for the peer review!
@Vancha112
@Vancha112 Жыл бұрын
@@kingofcastlechaos 😂
@lagenet8911
@lagenet8911 Жыл бұрын
My KZfaq ,@lagenet8911🎉My KZfaq ,@lagenet8911🎉
@Vancha112
@Vancha112 Жыл бұрын
My best python tip would be, that if you want, you can add types to python. Adding return types to functions greatly increases the readability of code without having to read the last lines of a function. It also helps to know what arguments a function expects, instead of just telling you it's name.
@fedorezeev9923
@fedorezeev9923 10 ай бұрын
You can do exactly this. PEP 484 introduced type hints in Python 3.5
@Vancha112
@Vancha112 10 ай бұрын
@@fedorezeev9923 that's what I'm saying, thanks for mentioning the PEP number :)
@faustipez
@faustipez Жыл бұрын
I've learned a ton of python thanks to you. Hope you keep making these tips and project videos, more backend and web development with python would be awesome!
@jonpotts3375
@jonpotts3375 Жыл бұрын
you have inspired me over the last few weeks to start learning how to code! My one project that pulls info from YT and shows me the most viewed videos, likes, etc on one subject using an API, i typed in, learn Python and so many of your videos were up top ! Please keeping making these videos my guy! much love
@ivan-youtube
@ivan-youtube Жыл бұрын
Great video! There is also a zip_longest function in itertools module which goes through as many items as the longest iterable has
@richardneumann3335
@richardneumann3335 Жыл бұрын
My tip: At 3:10 use operator.itemgetter() instead of a custom lambda. It's shorter and more concise and other devs can clearly see what one's doing in the keyfunc by reading the name "itemgetter" instead of figuring out what a custom lambda does. Costly seconds saved :D
@jonathanedwardgoode
@jonathanedwardgoode Жыл бұрын
Great tips as always! Just did a Javascript based full stack boot camp, but I had dabbled in Python and some of these concepts I now in Javascript but was curious about in Python. The biggest one was ternary operators.
@kamyararshi6235
@kamyararshi6235 Жыл бұрын
Thanks for the interesting tips! I learned and refreshed my memory
@LynxesYT
@LynxesYT Жыл бұрын
Also guys if you want items at specific position of a list, you can use: Say x = [1,2,3,4,5] print(x[0::2]) the '::' operator starts from the initial integer and gets item with distance of second integer until the end. Output: [1,3,5]
@Arkssa
@Arkssa 11 ай бұрын
start:stop:step
@uajoku
@uajoku 11 ай бұрын
Super handy tips. Thank you Tim!
@paulthomas1052
@paulthomas1052 Жыл бұрын
Great set of useful tips - Thanks Tim.
@taylormccoy7492
@taylormccoy7492 Жыл бұрын
That was great! Thank you man. Been learning python for the last 6 months or so and didn't know about a good quarter of those things despite my best efforts XD
@kapibara2440
@kapibara2440 7 ай бұрын
Great material Tim, thank you :)
@shitinsideyou
@shitinsideyou Жыл бұрын
Another great video! Thanks, you have helped a lot of people.
@farid5347
@farid5347 Жыл бұрын
Tim, you are awesome! Thank you, mate!
@Kumar.Freelancer
@Kumar.Freelancer Жыл бұрын
Thank you. I'm glad to know that I use all these tips in my python programs
@TheMe9595
@TheMe9595 Жыл бұрын
Zip is so useful. I taught my friend about that the other day. I still don’t understand lambda though and I have always felt like it’s difficult to read when lambda is used.
@uuzumakifox9
@uuzumakifox9 Жыл бұрын
Great vid man, thank you❤
@alimihakeem841
@alimihakeem841 Жыл бұрын
I always love to watch your videos due to the way you explain. I found it useful. Could please make a full stack app video using JavaScript and flask for backend
@seifelshlkany5032
@seifelshlkany5032 Жыл бұрын
Think it's gonna be interested and useful ❤
@Sinke_100
@Sinke_100 Жыл бұрын
After two years of python and knowing most of things mentioned I still apriciate a value of videos like this, I really liked callback lambda example
@PhunkyBob
@PhunkyBob Жыл бұрын
I didn't knew about the `setdefault` function in dictionaries. I always use "defaultdict" when I need this kind of feature. Glad to know another way!
@coderstribe4775
@coderstribe4775 Жыл бұрын
Thanks for sharing. Lambda is one of my best python feature
@BenRogersWPG
@BenRogersWPG Жыл бұрын
Great video, Tim. I'm so glad I subscribed to this channel!
@TechWithTim
@TechWithTim Жыл бұрын
Awesome, thank you!
@abithadani9860
@abithadani9860 Жыл бұрын
U r The best tutor for me so far. Ur teaching style are very clear
@rishiraj2548
@rishiraj2548 Жыл бұрын
👍🙏
@sinaorojlo5980
@sinaorojlo5980 Жыл бұрын
Awesome 🎉 Pleas make video about Enumerate
@TvD1985
@TvD1985 Жыл бұрын
Regarding the get() example, do you prefer this over defaultdict? from collections import defaultdict words = ... word_counts = defaultdict(lambda: 0) for word in words: word_counts[word] += 1
@Wintermute4
@Wintermute4 Жыл бұрын
Counter() from collections is my go-to for this sort of thing
@Dubai_life_
@Dubai_life_ 8 ай бұрын
Thank you.
@GTV_367
@GTV_367 Жыл бұрын
🙌🙌thanks
@Kay-qg1vn
@Kay-qg1vn Жыл бұрын
Hey Tim I hope you are. Can you give any tips on how you approached theory for retention in CS? I feel like whenever I am reading theory I read it passively. I am doing CS and Maths.
@Dipenparmar12
@Dipenparmar12 3 ай бұрын
Amazing tutorials
@BrannenTaylor
@BrannenTaylor 11 ай бұрын
I like to use ternary statements to do conditional printing. Like Flag = True somewhere. Then later, print (whatever) if flag else “”.
@talhaishan9487
@talhaishan9487 Жыл бұрын
Hi, I wanted to ask if I should start doing projects or start doing exercises to improve?
@extremeking2674
@extremeking2674 Жыл бұрын
Could you make a video on the latest features in python 3.10?
@nether-mobiletopc4293
@nether-mobiletopc4293 Жыл бұрын
Please do more tensorflow python courses pls
@dragonsage6909
@dragonsage6909 Жыл бұрын
These are gold, thx
@dragonsage6909
@dragonsage6909 Жыл бұрын
@TechWithTim_2 really!?
@venkyman4985
@venkyman4985 Жыл бұрын
Quick doubt: in the ternary operators, what if i dont have an else? is it still possible to use that syntax?
@wolfpain5928
@wolfpain5928 Жыл бұрын
Great video 👍.
@TechWithTim
@TechWithTim Жыл бұрын
Glad you enjoyed it
@dolodestinations7628
@dolodestinations7628 11 ай бұрын
I watched your 7 hour free code camp on tensorflow but it didn’t quite have what I needed. Looking for a tutorial on deep learning where a sports score is predicted. Not win or loss. But an actual number. Can you point me in the right direction? Please and thank you.
@Chuen666
@Chuen666 6 ай бұрын
another tips just like the last one in this video: # normal a=[] for i in range(1,101): if i%2==0: a.append(i) # equal a=[i for i in range(1,101) if i%2==0]
@jonahsatheesh5346
@jonahsatheesh5346 Жыл бұрын
Make a video on "CodeWhisperer"!!!
@felixmuller9062
@felixmuller9062 Жыл бұрын
Which theme do you use in VSCode?
@sethwilliams5352
@sethwilliams5352 11 ай бұрын
Also notable that the default second param of .get() is None, so no value error and a convenient truth check
@DrDeuteron
@DrDeuteron Жыл бұрын
I like lambdas (3:30). The other options is key=operator.attrgetter('age')
@richardneumann3335
@richardneumann3335 Жыл бұрын
Nope. But itemgetter() works in this case as per my comment. A dict has no attribute "age".
@DrDeuteron
@DrDeuteron Жыл бұрын
@@richardneumann3335 shoulda just replied AttributeError: 'dict' object has no attribute 'age'
@codingdidi-hindi
@codingdidi-hindi Жыл бұрын
Good to go with python language
@keenzeen
@keenzeen Жыл бұрын
Great! 🎉
@TechWithTim
@TechWithTim Жыл бұрын
Thanks! 😃
@sureshkhadka1020
@sureshkhadka1020 Жыл бұрын
Sir make a video of Django projects ✅🔥
@zzzzzzzzzz1250
@zzzzzzzzzz1250 Жыл бұрын
Just recently following you and yesterday ended one of your tutorials. they are easy to follow and you explain everything so clearly. thanks for that!!! Could you share some experience or tips on how to reach for a first job in (or with) python when you are at the beggining of this track? I'm trying to change paths here and I feel unsure on how to get a first job here without real experience. Thank you
@julianreichelt1719
@julianreichelt1719 Жыл бұрын
nice video!
@TechWithTim
@TechWithTim Жыл бұрын
Thanks!
@DrDeuteron
@DrDeuteron Жыл бұрын
regarding functions with some parameters fixed, say I want to add 3: >>>func = functools.partial(operator.add, 3) >>>func(10) 13 allows introspection: >>>func.args (3,) >>>func.func
@user-dz4uu2dr9p
@user-dz4uu2dr9p 5 ай бұрын
bro isn't a human 😮😮❤❤
@abdelghafourfid8216
@abdelghafourfid8216 11 ай бұрын
Actually some considers the for/else while/else as a bad pattern. There is a full explanation from mCoding on this.
@genie9262
@genie9262 Жыл бұрын
@umangsahu7291
@umangsahu7291 11 ай бұрын
Please anyone tell me the editor he is using???
@peace-to-the-world
@peace-to-the-world Жыл бұрын
Try to explain, why is following not gonna work without defining initial value for "_": x = 1 data = [(1, 'one'), (2, 'two'), (3, 'three')] def print2(y): y = y + x print(f"the y = y+x is '{y}', and _ is '{_}'") if __name__ == '__main__': x = x + 1 - 1 for f, word in data: f = f + 1 - 1 _ = _ + x print("word is '", word, "' ") print2(f)
@djcardwell
@djcardwell Жыл бұрын
Can you share a few more impractical things? I don't like practical
@jimmyjammers28
@jimmyjammers28 Жыл бұрын
Neesh neesh😂😂😂😂😢😢😢😢😮😮😅😅😊😊🎉🎉😮😢😢😢😢😢😢😮😂
@gkett19
@gkett19 11 ай бұрын
defaultdict > get
@B00BS.
@B00BS. Жыл бұрын
hi Tim
@TechWithTim
@TechWithTim Жыл бұрын
Hello
@staywithola9724
@staywithola9724 Жыл бұрын
@@TechWithTim Tim, is a good guy!
@DrDeuteron
@DrDeuteron Жыл бұрын
8:20 you can also do stuff like: >>>student_grades = collections.defaultdict(lambda: 90) >>>print(student_grades['Alice']) 90
@shubhambhattacharjee1111
@shubhambhattacharjee1111 5 ай бұрын
Please don't use nested ternary, it's always prety hard to look at.
@johnbett-bv6zi
@johnbett-bv6zi Жыл бұрын
still a beginner sorry to say this
@subinkv6849
@subinkv6849 2 ай бұрын
Please simplify the explanation. Some of the concepts are not clear.
@user-dl1su3li5s
@user-dl1su3li5s 10 ай бұрын
I wanted to say that if you see my msg, I have bought Programming expert course and it is utter waste. You are teaching as if its 10 year old learning programming. I took that course thinking it has shown around 251 problems to solve and I get frustrated seeing True or False question, this or that. Have some standard question You have add practice questions. Not 2nd grade questions. Very disappointed and not getting refund too.
@abdullahalharthi2576
@abdullahalharthi2576 11 ай бұрын
@TechWithTim can u do bygbag
@user-dl1su3li5s
@user-dl1su3li5s 10 ай бұрын
I wanted to say that if you see my msg, I have bought Programming expert course and it is utter waste. You are teaching as if its 10 year old learning programming. I took that course thinking it has shown around 251 problems to solve and I get frustrated seeing True or False question, this or that. Have some standard question You have add practice questions. Not 2nd grade questions. Very disappointed and not getting refund too.
Python Generators Explained
28:37
Tech With Tim
Рет қаралды 149 М.
Please Master These 10 Python Functions…
22:17
Tech With Tim
Рет қаралды 100 М.
Who has won ?? 😀 #shortvideo #lizzyisaeva
00:24
Lizzy Isaeva
Рет қаралды 65 МЛН
ВОДА В СОЛО
00:20
⚡️КАН АНДРЕЙ⚡️
Рет қаралды 29 МЛН
Spot The Fake Animal For $10,000
00:40
MrBeast
Рет қаралды 164 МЛН
5 Tips To Write Better Python Functions
15:59
Indently
Рет қаралды 98 М.
25 nooby Python habits you need to ditch
9:12
mCoding
Рет қаралды 1,7 МЛН
How To Create An Executable Python Program
3:48
Taylor's Software
Рет қаралды 1,7 М.
Python 101: Learn the 5 Must-Know Concepts
20:00
Tech With Tim
Рет қаралды 1,1 МЛН
10 Python Shortcuts You Need To Know
27:27
Tech With Tim
Рет қаралды 292 М.
10 Nooby Mistakes Devs Often Make In Python
24:31
Indently
Рет қаралды 55 М.
The Truth About Learning Python in 2024
9:38
Internet Made Coder
Рет қаралды 159 М.
5 Good Python Habits
17:35
Indently
Рет қаралды 454 М.
PLEASE Use These 5 Python Decorators
20:12
Tech With Tim
Рет қаралды 104 М.
5 Mini Python Projects - For Beginners
1:41:08
Tech With Tim
Рет қаралды 2,8 МЛН
Who has won ?? 😀 #shortvideo #lizzyisaeva
00:24
Lizzy Isaeva
Рет қаралды 65 МЛН