All language subtitles for 4. Truthy vs Falsey

af Afrikaans
ak Akan
sq Albanian
am Amharic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bem Bemba
bn Bengali
bh Bihari
bs Bosnian
br Breton
bg Bulgarian
km Cambodian
ca Catalan
ceb Cebuano
chr Cherokee
ny Chichewa
zh-CN Chinese (Simplified)
zh-TW Chinese (Traditional)
co Corsican
hr Croatian
cs Czech
da Danish
nl Dutch
en English
eo Esperanto
et Estonian
ee Ewe
fo Faroese
tl Filipino
fi Finnish
fr French
fy Frisian
gaa Ga
gl Galician
ka Georgian
de German
el Greek
gn Guarani
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian
is Icelandic
ig Igbo
id Indonesian
ia Interlingua
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
rw Kinyarwanda
rn Kirundi
kg Kongo
ko Korean
kri Krio (Sierra Leone)
ku Kurdish
ckb Kurdish (Soranรฎ)
ky Kyrgyz
lo Laothian
la Latin
lv Latvian
ln Lingala
lt Lithuanian
loz Lozi
lg Luganda
ach Luo
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mfe Mauritian Creole
mo Moldavian
mn Mongolian
my Myanmar (Burmese)
sr-ME Montenegrin
ne Nepali
pcm Nigerian Pidgin
nso Northern Sotho
no Norwegian
nn Norwegian (Nynorsk)
oc Occitan
or Oriya
om Oromo
ps Pashto
fa Persian
pl Polish
pt-BR Portuguese (Brazil)
pt Portuguese (Portugal)
pa Punjabi
qu Quechua
ro Romanian
rm Romansh
nyn Runyakitara
ru Russian
sm Samoan
gd Scots Gaelic
sh Serbo-Croatian
st Sesotho
tn Setswana
crs Seychellois Creole
sn Shona
sd Sindhi
si Sinhalese
sk Slovak
sl Slovenian
so Somali
es Spanish
es-419 Spanish (Latin American)
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
tt Tatar
te Telugu
th Thai
ti Tigrinya
to Tonga
lua Tshiluba
tum Tumbuka
tr Turkish
tk Turkmen
tw Twi
ug Uighur
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
wo Wolof
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu

Original subtitles

Welcome back.

In this video I'm going to talk about the idea of truthiness and falsely What did they mean.

And you'll hear this a lot in Python programming you see.

Up until now you've used billions here as values.

So it was really easy.

If true and true then run this code but Python can do other things as well.

For example if this was five and this was let's say hello what do you think will happen here in our

program.

Well if I click Run you are old enough to drive and you have a license.

Is that what you expected.

And this is because what Python does underneath the hood is actually convert these to billions for you.

So it's almost as if it is doing this remember type conversion where converting the type to boolean

as soon as we get to this if statement because python is saying hey I want true or false I don't care

what is old is I don't care what is license this just give me true or false.

So I know whether to do this or to go to the else block.

Now if I was to just print let's do this here let's do print boolean Hello.

And then finally print boolean 5.

Let's see what we get we get true true.

And this is what we call a truth the value in python that is it's a truth value because if we run the

boolean type conversion on it it evaluates into true what's a false value.

Well if I do zero and if I do let's say an empty string and I click run those are false.

That is it's not actually false but it is false see because if we run bullion on it to Python it's going

to say oh this is false and zero.

That's false.

And that kind of makes sense right.

And if you actually go to stack overflow.

If you've never seen stack overflow before.

If you ever have programming questions and you're Googling them usually the top five answers will contain

either one or two stack overflow answers.

And basically what happens is people ask questions like What is truth and falsity in Python and you

get answers so you can see over here that it has four answers and you usually look for the checkmark

which means that this is a verified answer and means that hey this question owner has accepted it as

the best answer.

So the person who asked this question just said Yep this is the right answer.

This is the best one.

But you also have other people voting so you can see that this answer received 46 marks and although

it was marked as the correct answer by the user maybe somebody else came along later on and gave an

even better answer.

So now we have one hundred and twenty three upvotes and you see that this answer is a lot better all

values are considered toothy except for the following so you can actually see here that in Python these

values are considered false see you can see 0 here you can see an empty string here and then there's

a few other ones empty set.

You have a empty dictionary empty list empty tuple you have decimals you have things like fractions

you have zero point zero false is that and also none is false.

So that if I type in none here that's false to now you don't need to memorize these because most of

the time it it makes sense right.

But it helps us do conditional logic very nicely.

For example let's remove this and let's say that we have a user and this user has to have a password

and a user name if let's say they user name is Johnny and the password is 1 2 3 well instead of me saying

hey if this user has password and username and we're not checking if the user name exists or password

exists we just want to make sure hey did this person fill out the form and did they try to submit a

user name and password.

I can just simply say password and username and I don't have to worry about converting this to a Boolean

or anything like that because if password and user name exist then tried to log them in and you see

that it reads a lot nicer because each one of these get evaluated into a true and false C value it's

a nice little feature to keep Python well nice and simple and reading like English I'll see in the next

video by.

Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.