Dictionaries in Python - Advanced Python 03 - Programming Tutorial

Dictionaries in Python - Advanced Python 03 - Programming Tutorial

Patrick Loeber

5 лет назад

90,146 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

Antonio Woodward
Antonio Woodward - 29.10.2023 05:49

You guys watch each other tutorials before creating one? You folks all show the same methods!! Watch one and you watched all, right?? Waist of my time.

Ответить
Diego Diego
Diego Diego - 01.08.2023 07:26

thank u man

Ответить
Mahin Shahriar
Mahin Shahriar - 31.05.2023 21:34

Helpful and Informative

Ответить
Kesavan Ela
Kesavan Ela - 25.05.2023 00:06

I'm never naming my dictionary as "myDict"

🙂

Ответить
L A
L A - 17.12.2022 03:38

for those new to this topic like me

in the example 'USA': 'Washington DC' - USA is the key and Washington DC is the value

May seem obvious but realising this made me understand this easier and hopefully you too

Ответить
L A
L A - 17.12.2022 03:25

you explore parts of topics that a lot of others do not.
much appreciations for that

Ответить
Gleyson Santos
Gleyson Santos - 16.12.2022 11:45

It was really helpful, thank you.

Ответить
Irina St Louis
Irina St Louis - 27.11.2022 21:17

I have a table and I want to assign my keys as a Table Headers. Table has 50 columns (keys) and 100 rows.

Ответить
naren mallya
naren mallya - 28.08.2022 12:44

So when I use popitem() it returns me the key and value of that dictionary( which was under curly braces { } ) as a tuple ( (... ...) ). May I please know what is the reason behind it or it is by definition/ trivial

Thanks for the great video content!

Ответить
Bream Garces
Bream Garces - 19.07.2022 11:10

mydik = {'size': ['small', 'medium', 'large'], 'color':['brown', 'red', 'black'], 'weather':['warm','cold']}

print(mydik['size'][0])
print(mydik['color'][0])
print(mydik['weather'][1])

Ответить
Akash Darji
Akash Darji - 19.07.2022 02:53

Awesome Awesome Awesome

Ответить
Darragh Power
Darragh Power - 09.06.2022 23:52

mydict :p

Ответить
Matej Ivosevic
Matej Ivosevic - 04.05.2022 16:59

2.
s=input()
s=s.split()
h=[]
for i in s:
h.append (i[::-1])
k=" ".join(h)
print("obrnuto", k)
a=[]
for j in h:
a.append(j.count("a"))

r=[]
for y in range (len(s)):
l=a.index(max(a))
r.append(s.pop(l))
a.pop(l)
print(r) rijeci po broju slova a

Ответить
Matej Ivosevic
Matej Ivosevic - 04.05.2022 16:54

1.
s=input()
brojrijeci=s.count(" ")+1
print(brojrijeci)
s=s.replace("a","")
print(s)
r={}
s=s.split()
for i in s:
r.update ({ i:len (i) })
print(r)

Ответить
Ignacio Leikis
Ignacio Leikis - 03.05.2022 21:16

Can you add a key to a dictionary with multiple values AND multiple value types? i.e. "Variable1": "MyName", 14, [A, B, C]
Awesome tutorial!

Ответить
はるまき
はるまき - 19.04.2022 06:44

Excellent video
Now I think I can deal with Dict:

my_dict = {"content": something, "length": None}
instance = my_dict.pop("content")
my_dict["length"] = scan(instance, in="cm")
if my_dict["length"] > 12:
yup()
else:
nope()

Ответить
Cris Ortiz
Cris Ortiz - 05.04.2022 03:05

Kudos to you, the way you applied this tutorial helped me understand how the other concept works as well.

THANK YOU!

Ответить
srinivas nagulapally
srinivas nagulapally - 04.04.2022 13:40

how to add a element at particular index?

Ответить
Rodrigo DL
Rodrigo DL - 30.03.2022 15:45

From 3.7+ dictionaries are now "insertion ordered"

Ответить
Amir
Amir - 15.02.2022 03:49

Thanks so much for the useful video.

Ответить
Borki
Borki - 27.01.2022 01:59

I was listening to this one my speakers at max volume and just kept hearing mydi**

Ответить
Elena Romanova
Elena Romanova - 07.01.2022 06:25

Thank you

Ответить
ROHAN PHILIP
ROHAN PHILIP - 22.12.2021 10:57

which IDE do you use?

Ответить
Enrique Williams
Enrique Williams - 14.12.2021 03:31

You go so far the tutorial is worthless.

Ответить
Guna Hawk
Guna Hawk - 03.12.2021 17:25

man love this videos , god bless you

Ответить
Mahmoud Abbasi
Mahmoud Abbasi - 20.11.2021 13:09

Excellent!

Ответить
BCTAHbKA
BCTAHbKA - 08.11.2021 01:03

Это лучшее видео на свете

Ответить
akshatha t
akshatha t - 07.09.2021 19:25

Sir very nice video. I have one question , how to print specific key value in a dictionary. Without entering its name in code. We should get the output as - Enter the product name ( some key)
- it's value should come as output. Please help me sir.

Ответить
ronyut1984
ronyut1984 - 24.07.2021 11:15

Dictionaries: test your comprehension:
- how to initialize a dictionary? (2 ways)
- how to delete by key? (2 ways)
- how to delete the last inserted key? (only as of python 3.7)
- how to iterate keys, values and elements?
- how to copy a dictionary? (2 ways)
- can a tuple be a dictionary key? why?

Ответить
Rich Lysakowski
Rich Lysakowski - 23.07.2021 05:48

Change the name for this video series. This is beginner stuff. Don't
lie to people by calling it advanced. You lose your credibility from
the start when you LIE to people right from the start.

Ответить
Ritik Kumar Choubisa
Ritik Kumar Choubisa - 03.07.2021 14:31

Sir I Ask One Questions Please....??

In this 21 lecture...a to z python is completed....Basic to advance everthing ??? Say me sir please

Ответить
Cleverest Mind
Cleverest Mind - 28.06.2021 17:00

Quit Interesting

Ответить
Christos Kili
Christos Kili - 29.05.2021 19:46

The t is sometimes missing in mydict...

Ответить
Abdullah Assaf
Abdullah Assaf - 26.03.2021 02:24

you wrap up on everything, you are a legend

Ответить
Phoenix
Phoenix - 19.03.2021 06:58

This is a great series to speed through for my upcoming interview!

Ответить
Wenyan Ge
Wenyan Ge - 15.03.2021 16:39

a little trick: reverse dictionary's key and value

mydict = dict(a=0, b=1, c=2)
print(mydict)
reversed_mydict = {v:k for k, v in mydict.items()}
print(reversed_mydict)

{'a': 0, 'b': 1, 'c': 2}
{0: 'a', 1: 'b', 2: 'c'}


Use with caution. When you have same value in the dictionary, the reversed dictionary's value may be overwritten.
mydict = dict(a=0, b=1, c=1) # both b and c have the same value 1
print(mydict)
reversed_mydict = {v:k for k, v in mydict.items()}
print(reversed_mydict)

{'a': 0, 'b': 1, 'c': 1}
{0: 'a', 1: 'c'}

Ответить
Riza hariati 依扎 Icha
Riza hariati 依扎 Icha - 01.12.2020 11:18

hahaah..thank you

Ответить
Maxim K
Maxim K - 27.11.2020 19:40

What is mutable?

Ответить
Andrew Li
Andrew Li - 21.10.2020 13:37

Hi, I just started coding and I was wondering what platform you're using for your code. I've been coding through IDLE but it's a lot less easier to create big functions and see the outputs clearly, so I was just wondering

Ответить
Alberto Reyes (dayofthetech_error)
Alberto Reyes (dayofthetech_error) - 19.10.2020 00:54

Hello, I'm recently starting using VS Code for my python projects, how are you able to run the code on the output section without running the whole file address, I'm having trouble on that. Thank you.

Ответить
gabriel cohen
gabriel cohen - 12.07.2020 19:11

Im just starting to learn Python. I just wanted you to know how insightful and helpful your videos are. I have a question - I have a large file of data organized in alphabetical order. what is an efficient way to parse out ONLY USA data. the file is a .txt file. any comments would be appreciated, I will continue with your site thank you

Ответить
Zamar
Zamar - 02.04.2020 11:08

Thanks for this wonderful video, you explained a very simple way. I have one query related to a python dictionary is it possible we can store excel data into a python dictionary and perform some CRUD operation on it.

Ответить