All language subtitles for 08_data-types.en

af Afrikaans
ak Akan
sq Albanian
am Amharic
ar Arabic Download
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
sr Serbian
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

If you're not sure what type a given value has,

then Python has a nice function called type,

and what type does is it tells us what the type of a given value is.

So, for example if we print out the value of type when called with the string "Hello,

world" as an argument then Python is going to tell us that this is a string.

It'll tell us that this isn't int,

and then here if we don't call the type function we get the value itself,

but if we print out the type of 3.2 then we get that this is a float.

So let's run our code and what you'll

see is that when we print out the type of Hello world.

Then Python has a way of telling us that this is a string.

Print out the type of 17 Python is telling us this is an integer.

This is just us printing out the string hello world itself,

but if we print out the type of 3.2 then Python tells us that this is a float,

and this can be especially helpful in situations where

you're not necessarily sure what type something has.

So for example here we have a value 17,

and even though this is a number because it's in quotation

marks the value of this expression is going to be a string.

So the type of this expression is going to print out class str.

Same thing with this.

So even though 3.2 is a float because these are in quotation

marks this overall expression is a string.

So if I run my code then I'll see that both of these are strings.

Now there are few other things to note when working with Python expressions.

First, when creating a string,

as we mentioned, there are multiple ways of creating a string literal.

One is using a single quotes mark.

Another is using double quotation marks.

Another is using three double quotation marks or three single quotation marks.

Now, the important thing to note is that

even though all of these expressions create a string in

a different way if we ask what's the type of each of

these then Python is going to tell us that these are all strings.

So even though we create strings in four different ways

here all of these boil down to the same type in Python,

which is a string.

So another thing to note when creating strings is that sometimes you

want to include single or double quotation marks inside of a string.

So for example I might want to print out

the string 'Bruce's beard'.

Now here you'll note that I have an apostrophe in

Bruce's and when I try to run my code then Python gives me

a syntax error and that's because to Python it thinks that this is the string

because it thinks that this quotation mark starts

the string in that the apostrophe is supposed to end it.

One way to get around this is by using

double quotation marks if we know that we're

going to have an apostrophe inside of our string.

So here this works.

Conversely, if we had a string that we knew would contain double quotation marks,

again if I run this code then I get a syntax error because

Python thinks the string starts here and ends here,

but one way around it is by using single quotation marks to create the string.

If I have a string that might contain single and double quotation marks,

then one way around that is by using triple quotation marks.

So I might say something like," Oh no",

she exclaimed, "Ben's bike is broken!"

So now I can use both double and single quotation marks inside of the string,

and again triple quotation marks allow us to create strings that span several lines.

Another thing to note when creating an integer is that in the US we

often use commas every third digit in larger numbers.

So for example we might indicate 42,500 using a comma like this,

but here if Python sees a comma inside of

the integer it thinks that these are two separate values.

So it thinks that we're printing out 42 and then 500 as separate values.

So when we're creating large numbers in Python we

shouldn't ever use commas to separate out every three digits.

We need to write the integer like this and now we have the number 42500 in one value.

One more thing to note along those lines is that we can call

print with any number of arguments and when we do,

print decides to take every argument and printout

it's value separated by spaces instead of commas.

So here we're printing out all of these values on

one line and then all of these values on the next line.

So let's do a few multiple choice.

How can you determine the type of the variable?

Well, one way to determine the type of the variable is by using the type function.

Next question is what is the data type of: This is what kind of data?

So in other words if we called type on this expression then what would we get?

Well, Python would tell us that this is a string

because it starts and ends with a single quotation mark.

That's all for now. Until next time.

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