Python f-strings | String Formatting | Conditions in f-strings | Python Debugging | Advanced Strings

preview_player
Показать описание
Learn how to use Python f-strings to make string formatting a lot easier in Python! Learn how to evaluate expressions, use conditions, loop over dictionary items, and use new Python 3.8+ f-string debugging features.

0:00 Intro
0:30 What are python f-strings
1:15 How do you write Python f-strings
3:00 Evaluating Expressions in Python f-strings
4:00 Using Variables in Python f-strings
4:40 Accessing Dictionary Items in Python f-strings
5:53 Looping over items with Python f-strings
7:04 Conditions in Python f-strings
10:02 Align strings with Python f-strings
12:13 Format values with Python f-strings
15:43 Debugging with Python f-strings
17:08 Conclusion

Learn Python programming the right way!

----------------------------------------------------------

✅ Follow me on other platforms:
Рекомендации по теме
Комментарии
Автор

Wtf this video was so well made I didn't realize how small the channel was until I hit the bottom of the comments section in a minute, damn man, thanks so much for extremely high quality tutorial. VERY Helpful!

zakthayer
Автор

Right to the point. So very helpful! Thank you.

TheVikingOfNanotech
Автор

thanks a lot this video was very helpful!

gehnasharma
Автор

Hi datagy, thanks for this and all your other helpfull videos. They have been very usefull!!

I try to code along with your videos with the use of my own datafile (which contains info on tennis Grand Slams). Everything worked out great, so now I can do stuff like

# Use f-strings to loop over dictionaries
grandslams_info = [{'name': 'Australian Open', 'short': 'AO', 'city': 'Adelaide'},
{'name': 'Roland Garros', 'short': 'RG', 'city': 'Paris'}]

for info in grandslams_info:
print(f"{info.get('name')} is held in {info.get('city')} and is in short the {info.get('short')}")

and I get:

Australian Open is held in Adelaide and is in short the AO
Roland Garros is held in Paris and is in short the RG

Thanks a lot! Keep making these great videos!

sandervalentijn
Автор

@datagy need help,
write a Python function(func4) that takes value of slope(m) and x-intercept(c) and return the equation of
line(y=mx+c) as \vell as display it on screen. Please note that if slope is negative then x-intercept should be
positive and if slope is positive then x-intercept should be negative. You can consider O as positive number.
For example : m=-2 and c=O then equation will be y=-2x

hafizmuhammadabdullahkhan