Тёмный

dict.get() default value // Python One-Liner Tips & Tricks 

Noah Rubin
Подписаться 23 тыс.
Просмотров 682
50% 1

In this video, we look at how to use the default` keyword argument for the dict's get function to simplify our code.

Опубликовано:

 

31 янв 2019

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 6   
@PandaPlaysAll
@PandaPlaysAll 5 лет назад
I'm loving the series. Id love to see it for everything else like java. Networking. Linux databases etc
@georgezolla4580
@georgezolla4580 5 лет назад
Works perfectly with the ".get (word, word) “ correction. I would add a little vido snippet on the end of your video to mention the change!
@nro337
@nro337 5 лет назад
This is lovely
@georgezolla4580
@georgezolla4580 5 лет назад
Good lesson, I learned a lot about creating functions. However wehn I tried to run your one line code I recieved some errors. Could someone look at my code and help? def expand(word): return {"can't": "can not", "don't": "do not", "won't": "will not"}.get(word, default = word) word = “don’t" print (expand(word))
@NoahRubinCoding
@NoahRubinCoding 5 лет назад
Whoops, I made a mistake! The ‘default’ label isn’t supposed to be there, so it’s just get(word, word). Not sure how to go about fixing that in the video...
@skillfulactor09
@skillfulactor09 4 года назад
Is there a book you read about this one linear or did you make this All up wit your good
Далее
key Function // Python One-Liner Tips & Tricks
12:32
Просмотров 2,2 тыс.
готовка с Даней🥹
00:59
Просмотров 571 тыс.
Dictionary in Python
12:24
Просмотров 1,3 млн
The fork() function in C
11:16
Просмотров 357 тыс.
Python ASCII Converter (Lab 5 // CS University)
16:19
Просмотров 3,1 тыс.
How To Use Functions In Python (Python Tutorial #3)
14:55
Why do programmers confuse Halloween and Christmas?
9:28
10 Years of Programming: A Retrospective (Part 2)
22:04
Genetic Algorithms Explained By Example
11:52
Просмотров 316 тыс.
MultiPhone: Connecting 100 iPhones with a Custom App
17:13