Or maybe use it like a variable bank (name, str, hp, etc.) Do the numbers work like ints or are they strings? Can you convert them? Sure there are other ways to store variables in similiar ways but it would be cool, clean way I guess.
Thanks a lot for all that you do,....it's great, That avoid to loose time and it is very convenient, comfortable and understable. That allows us to test other thinks into each lesson. Bye, The french guy.
Hey Bucky/Fellow commenters, I have a question for you all.
I am n00bsauce, so I was just wondering how dictionaries/lists can be used when writing programs. I can make them work, but I'm not sure how when could be used.
Thanks guys,
ANorseHorse
P.S. Bucky your tutorials are the bomb, they have taught me so much already. You are awesome. I salute you.
@ANorseHorse I work with different IR detectors, and I use the dictionaries to look up given readmodes based on parameters of files. e.g.: {1:'high-noise',16:'medium-noise',256:'low-noise'} Pretty useful things! Even dictionaries of dictionaries pop into use sometimes.
random question: what if I wanted to make a program that functioned like a folder? Like you start it up, you're asked which game/application on your hard drive you want to start. How do I start an .exe that's elsewhere in my hard drive? How do I make a program that ties .exe's to said program?
Hi, i tried some thing and its worked then i remembered the vedio-18 where we got knowledge about "input" 7"raw_input". IF we want to work with number then need to use "input" but i was using "raw_input".
Now correct answer is :-
x={1:'Apple',2:'mango',2:'orange'}
y=input("Please enter value from 1 to 3 and see suprise for u")
The values can also be an integer. I added the ages of my 'parents' which worked by leaving out the quote marks around them. I also used numbers as keys, like and ID. :)
well, web templating frameworks (ie django) use dictionaries to pass objects to the html script. The name of the object is whats referenced in the html code.
its different. If you "tuna=ages" then you are telling the program to store the information for "tuna" and "ages" in the same spot. So if you change something in "ages" you also change that same thing in "tuna".
however, if you "tuna=ages.copy()" then it copies the information in "ages" to the memory location of "tuna." so you can change ages without changing tuna and vice versa.
Thats more like a GILF
downsideup222 2 days ago
"in" is preferred over has_key() since Python 2.3
ncdave4life 6 days ago in playlist Python Programming Tutorials
I have been following bucky's video for a while now, now i just have a question.
how is the shell related to the actually program?
I know shell can help us to figure out things, but how can the stuff we learn on shell put on the program.
example like this tutorial about dictionary
please help :)
TERRY82014 2 weeks ago
Or maybe use it like a variable bank (name, str, hp, etc.) Do the numbers work like ints or are they strings? Can you convert them? Sure there are other ways to store variables in similiar ways but it would be cool, clean way I guess.
Nikotiini69 1 month ago in playlist Python Programming Tutorials
I can see how this could be very usefull for things like storing info for examing item like in Runescape (examine rock -> this is a rock).
Nikotiini69 1 month ago in playlist Python Programming Tutorials
WOW
DontBeSoRambo 1 month ago
um how would you get the Dad and the Mom bit so it would be bob and lisa like a cipher basically
rosskindred 1 month ago
In python 3 its print(book["Dad"])
xLDH1109x 1 month ago in playlist Python Programming Tutorials
does he know what a milf is?
gominireo 1 month ago
So can you not do this with Sequences? I mean the only difference is like ':'
xInstinctful 2 months ago in playlist Python Programming Tutorials
Seriously... Thank you so much for all of this. This is very much undervalued, you are awesome!
B1eSSinGNdisGuisE 2 months ago
thanx mate
reshad009 2 months ago
thanx bro learnd allot
reshad009 2 months ago
lol retuna
its return haha
rednut416 3 months ago
Thanks a lot for all that you do,....it's great, That avoid to loose time and it is very convenient, comfortable and understable. That allows us to test other thinks into each lesson. Bye, The french guy.
AlephAriadiate 3 months ago
In python 3 the has_key() function was removed.
Use " 'Mom' in tuna " instead of " tuna.has_key('Mom) "
ryuichirapha 4 months ago 28
@ryuichirapha Thanks, very helpful for we 3 users.
JackMyersPhotography 4 months ago
@ryuichirapha I don't understand, what's the syntax for it....
xInstinctful 2 months ago in playlist Python Programming Tutorials
@ryuichirapha You can also do this in python 2. Or at least the one I have, 2.7 !!
shahiros 6 days ago
I think you meant "cougar," not "MILF."
I hope.
LikwidCake 4 months ago
Comment removed
talHAK6412 4 months ago
you like to fuck 87 year old women?
AlwaysDestructable 4 months ago
for python 3.2 i have learned that we use 'Key in Dict' i.e 'mom' in tuna. it returns boolean. The learning goes on @TheDesignSong
MrRapell 5 months ago
for python 3.2 i have learned that we use 'Key in Dict' i.e 'mom' in tuna. it returns boolean. The learning goes on @TheDesgnSong
MrRapell 5 months ago
I don't think that Python 3.2.2 the has_key() method
TheDesignSong 5 months ago
Comment removed
LikwidCake 4 months ago
This has been flagged as spam show
@TheDesignSong In later Pythons, you can use "in" instead of has_key(). So in Bucky's dictionary you could input:
"Mom" in ages
and it would return True.
LikwidCake 4 months ago
When you the method "tuna.has_key('Mom")
and if you spelled "Mom" as "mom" its case sensitive so it will come up as false if you dont spell it the same way you did before
Please thumbs this up so people can know about this so they dont get confused
Lazaruzerick 5 months ago 3
@Lazaruzerick Another VERY important thing, in Python its "True" and "False" and not "true" and "false"
supersushi269 1 month ago
hahaha, 87 year old MILF. lmao.
clab077 6 months ago in playlist TheNewBoston - Python
your the best
facebookhackerrr 6 months ago
like an associative array in php?
whatsajaymo 6 months ago in playlist Python Programming Tutorials
My mom's name is Lisa and my brother's name is Joe.... 0.0
hetamalo 7 months ago 4
@hetamalo is she a MILF?
ihsanahsan 5 months ago
i was trying hard to not find you funy but I lol`d @ mom being a casual sounding 87 year old milf Lol
BlueRizlaz 7 months ago in playlist Python Programming Tutorials
tuna=ages gives the same result as tuna=ages.copy() so i don't really see the point
pythonmaster1337 7 months ago 4
@pythonmaster1337 Because if you type ... tuna=ages ... tuna becomes a reference to ages not a copy of ages.
anarkoFred 6 months ago
@pythonmaster1337 it is for use in algorithms and programs that you have to copy only portions of the dictionary
inuasha880 6 months ago
Wham Bam Sam!!!!!!
dextersaga 7 months ago
I can now finally remember my family's names.
42f87d89 8 months ago
How could I intergrate this into a raw_input or input search query?
ajr4265979 8 months ago
Is there a way to do a reverse search in a dictionary? Mean, entering a value and getting a key?
srnmd 8 months ago
Comment removed
srnmd 8 months ago
Isnt it called a hash rather than a dictionary?
Majskolvenz 9 months ago
@Majskolvenz
Either, apparently.
BeBoBli 8 months ago
lawl. "She's a MILF" :P
Iamthemaster2 10 months ago 8
I see why you like old women. ; )
....because your dad does.
Supertoad25 10 months ago 7
If bucky pauses this video at 6:12 i will jump out of my chair
Starcraft2Rogue 10 months ago
an 87 year old MILF???
she must look very, very good for yer age! :-D
jp246810 1 year ago 44
{ 'Dad' : 42 , 'Mom' : ''87' }
fangchen418 1 year ago 4
I laughed so hard at
"How old could she be.. uuh... 87!"
Zerstoererh 1 year ago 4
@Zerstoererh She's a milf. xD
ken4y66 1 year ago 2
thisvid.has_key('awesomeness')
True
atomicpantz 1 year ago
Hahaha 87, she's a milf. This guy is hilarious
mischatf 1 year ago
i really think that u can do anything, if u rule this 4 languages: Java/C# (almost the same^^), PHP , C and Phyton.
watched today 24 of his tuts :D
NikolaiPT 1 year ago
Woah, an entire tutorial without a mention of Easyhoss. Are you feeling well?
PlasticPackage 1 year ago 6
if you're using Python 3.x has_key will not work. do ('Mom')in tuna
xkyle567x 1 year ago 6
these are called arrays in other languages
killcamike 1 year ago
@killcamike in java for examples.. but.. in arrays you gotta specify what type of variables they gonna be..
(idk english)
konker666 1 year ago
i cant seem to use dictionaries i create in my "new window" and ill do
print "words,words" + dictionary
and when i do run it says "dictionary isnt described? can a string and dicitonary not mix?
SOLOSHOCKcom 1 year ago
@SOLOSHOCKcom I guess they are different data types...
xero907 1 year ago
This has been flagged as spam show
It is a good day try to find good Russian girl gettop5.info
MrBuddikabuddika 1 year ago
She's a milf.
XtronGraphics 1 year ago 17
this is helping me with my homework right now ^_^
1stAjay 1 year ago 4
ha 2:59 "how old can she be...87,. she's a MILF." LOL!!
termenat3000 1 year ago 3
"mom 87 she's a milf" lol!
primer131stdivrecon 1 year ago 7
If anyone wants to know, if you're using v3, use "'Mom' in tuna" (no quotes)
patq911 1 year ago
The best part in this tutorial: 1:30
11889music 1 year ago
@11889music
dont get it
thecreapyandweirdone 1 year ago
@thecreapyandweirdone "We have a bro, and his name is Joe; Joe the bro"
11889music 1 year ago
python 2.6.1 tuna.has_key('mom')....in python 3... 'mom' in tuna
Grigoris179 1 year ago 3
@Grigoris179 Thank you so much. I'llbe lost w/out your imput.
walterbennetsen 11 months ago
@dustinbrichardson in python 3... type.... 'apples' in tuna
Grigoris179 1 year ago
>>>book={'Green':'Come on, its a fucking colour, why are you looking this up?'}
Best dictionary EVER
Iglitchlife 1 year ago
dictionary = {'Bucky':'pure awesomeness' 'bucky's tuts':.......}
ERROR: bucky's tuts are to great to compute!
Hey that dictionary is wrong! Bucky is actually...
breathtaking, awe-inspiring, magnificent, wonderful, amazing, stunning, staggering, imposing, stirring, impressive, mind-boggling, mind-blowing, jaw-dropping, excellent, marvellous.
That is ¡¡¡¡¡¡¡¡¡¡BUCKYBUCKYBUCKYBUCKYBUCKY!!!!!!!!!!!
I LOVE PYTHON
elementoxygen 1 year ago
@dustinbrichardson python 3 differs from 2 (2.6 2.7 etc) so if you wana follow bucky exactly you must download the 2.6 or 2.7 version of python
didagoal 1 year ago
In the example where you use numbers inside a dictionary, it should be as follows -
ages = {'Dad':42.0, 'Mom':87.0}
You used strings in your example. Which is same as before. (Look at the color coding and also ' ' around the number returned.)
neerajadsul 1 year ago
@neerajadsul There's nothing wrong with using the numbers as strings, they don't have to be any particular type.
jimmayl1 1 year ago
Hey Bucky/Fellow commenters, I have a question for you all.
I am n00bsauce, so I was just wondering how dictionaries/lists can be used when writing programs. I can make them work, but I'm not sure how when could be used.
Thanks guys,
ANorseHorse
P.S. Bucky your tutorials are the bomb, they have taught me so much already. You are awesome. I salute you.
ANorseHorse 1 year ago
@ANorseHorse I work with different IR detectors, and I use the dictionaries to look up given readmodes based on parameters of files. e.g.: {1:'high-noise',16:'medium-noise',256:'low-noise'} Pretty useful things! Even dictionaries of dictionaries pop into use sometimes.
jimmayl1 1 year ago
@jimmayl1 D: Sound pretty fancy!
Thanks though, that would make sense.
ANorseHorse 1 year ago
This has been flagged as spam show
Couldnt you just type tuna=ages?
purplepandaco 1 year ago
what do we need dictionaries for?
MrCorn011 1 year ago
Thanks po
ffffgen 1 year ago
how do you convert a list into a dictionary??
luckyycharrm 1 year ago
Lisa is a little girls name. You can't be old and named Lisa.
Also, what do I use if I want to find the difference between two values tied to ... stuff?
example: I want to find the difference between my sister's age and my own
dif={'My age':'17','sis':'21'}
What command do i use to find the diffrence between difference between dif['My age'] and dif['sis']?
pappegye 1 year ago
This is for Python 2. In Python 3, the has_key method is no longer available; the "in" operator is used, instead. Instead of:
tuna.has_key('Mom')
use
'Mom' in tuna
ncdave4life 1 year ago 3
rofl "mom can be 87, she's a milf" ahahah
EldMage 1 year ago
@TheBoyyini no1 asked
jellybellies132 1 year ago
okay, I have some question. Which way is the most suitable to keep large variables?
let:
x, y, z, = "Bucky", "have", "tuna"
--or---
book={'x':'Bucky', 'y':'have', 'z':'tuna'}
TheBadminto 1 year ago
"hmm 87 . she's a milf." nice one! :D
iLaengsi 1 year ago
why does he always use the python shell instead of an ide like wing or idle?
AntiDragonBomb 1 year ago
FYI Python 3.0 or greater removed the "has_key" method.
It is now simply: 'Key' in Dictionary name
So for example where Bucky has: tuna.has_key('Mom')
This would now be simply: 'Mom' in tuna
woofa20 1 year ago
mom is 87, she's a milf....
YupHio 1 year ago 4
I don't think some one would have a 42 year old dad and an 87 year old mom that "mom" would be old enough to be dad's mom.
MrDellDude 1 year ago
I can't stop watching your tutorials. Good job man!
parpar9 1 year ago
random question: what if I wanted to make a program that functioned like a folder? Like you start it up, you're asked which game/application on your hard drive you want to start. How do I start an .exe that's elsewhere in my hard drive? How do I make a program that ties .exe's to said program?
MuikJuaggre 1 year ago
3:00
L O L :P
Great tut.
F1R3P1L0T 1 year ago
Hi Bucky, I need ur help. I need software details by using that you are zoom in/ zoom out certain part of desktop as i seen in your video.
Annu123456 2 years ago
@Annu123456 It is called Camtasia Studio, probably version 6.
GPianist 2 years ago
windows vista and win7 has a built-in software that does it for you (but it follows ur mouse)
augustuen 2 years ago
@augustuen Whats the name?
Raener 1 year ago
@Raener I don't know exactly, but it has an really ovbious name
augustuen 1 year ago
Do any one know about informatica/cogns training online ?Plz plz help me on that
Annu123456 2 years ago
Hi, i tried some thing and its worked then i remembered the vedio-18 where we got knowledge about "input" 7"raw_input". IF we want to work with number then need to use "input" but i was using "raw_input".
Now correct answer is :-
x={1:'Apple',2:'mango',2:'orange'}
y=input("Please enter value from 1 to 3 and see suprise for u")
print y
x[y]
print"u love sweet" +x[y]
input("please enter any ket to exit")
Annu123456 2 years ago
This program works better:
x={1:'Apple', 2:'mango', 3:'orange'}
y=input("Please enter value from 1 to 3 and see suprise for you: ")
x[y]
print"u love sweet " +x[y]
raw_input("please enter any key to exit")
emileokada 2 years ago
Thaks a lot Sir
Annu123456 2 years ago
i write one program but its not working..plz help.
x={1:'Apple',2:'mango',2:'orange'}
y=raw_input("Please enter value from 1 to 3 and see suprise for u")
print"u love sweet" +x[y]
raw_input("please enter any ket to exit")
Annu123456 2 years ago
@Annu123456 x = {'1':'apple','2':'mango','3':'orange'} that's the correction to your line 1.
Braniacwitdatgat 2 years ago
Thanks a lot bucky
Annu123456 2 years ago
Very good stuff bucky hats off to you my friend
nuckles0000 2 years ago
lol this guys funny as hell
CaseyLikesCheez 2 years ago
The values can also be an integer. I added the ages of my 'parents' which worked by leaving out the quote marks around them. I also used numbers as keys, like and ID. :)
These tutorials make this SO easy and fun!
icekat83 2 years ago
retuna
Jaximus0001 2 years ago
omg there are so many of these
AfterShockPivot 2 years ago
I believe at 87 you'd be a GMILF not a MILF.
Zaekk 2 years ago 2
hahaha, joe the bro, and mom the milf. this guy is funnier than he thinks
fireball84513 2 years ago 3
Dictionary can be used for setting multiple variables with ease.
xXdaveXsuperstarXx 2 years ago
this guy is awesome
ngatangs22 2 years ago 92
haha he said milf
tinimakoo 2 years ago
This comment has received too many negative votes show
He also said dick..... its in DICtionary....
radrox895 2 years ago
Good one
anonymousassasin1 2 years ago
dictionaries used for creating music player?
j1dobbs 2 years ago
Whats the difference between 2.6.1 and 2.6.2? because mines version 2.6.2 of python but yours is 2.6.1...
ILCAC3 2 years ago
in 2.6.2 are some bugs fixed........
matijatu 2 years ago
I dont' get it, where would we use dictionary, I mean, in what programs?
srav953 2 years ago
you can use it in anything. i don't let term confuse yeah
CrazyMofoCooling 2 years ago
well, web templating frameworks (ie django) use dictionaries to pass objects to the html script. The name of the object is whats referenced in the html code.
BinaryReader 2 years ago
Django uses Context, not 'only' dicts ;)
LordKelvan 2 years ago
telephone books f.e.
frundelix 2 years ago
I used dictionaries in a small Phonebook program I made! :D
srav953 2 years ago
I guess you can use the dictionary method in dictionary programs xD
ILCAC3 2 years ago
You can use it nearly everywhere ;)
I'm coding php, python/django at work and java for the university and I'm using dicts in most of the programs.
dicts are nice for returning more than one var from a function ( ok, using objects is often better ;) )
One thing I missed in the tutorial is that you can insert everything in an dict, not only strings ( or integers saved as strings :-/ )
LordKelvan 2 years ago
using tuna = ages gives the same thing as tuna = ages.copy()
is there any advantage in using copy()?
yamdongjai 2 years ago
its different. If you "tuna=ages" then you are telling the program to store the information for "tuna" and "ages" in the same spot. So if you change something in "ages" you also change that same thing in "tuna".
however, if you "tuna=ages.copy()" then it copies the information in "ages" to the memory location of "tuna." so you can change ages without changing tuna and vice versa.
sirtwizt 2 years ago 35
@sirtwizt no, you're wrong..
JukJuca 1 year ago
@sirtwizt Oh now I get it. Awesome, thanks dude (:
ShiftingStampy 1 year ago
@sirtwizt
it is the same thing with JAVA =) ..
konker666 1 year ago
yay!!!
varun009 2 years ago
Thx Great Vid!!
Samppf 2 years ago
Cool! :)
MexicanRufus 2 years ago