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
Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated: 1 00:00:00,350 --> 00:00:04,530 If you're not sure what type a given value has, 2 00:00:04,530 --> 00:00:07,620 then Python has a nice function called type, 3 00:00:07,620 --> 00:00:11,955 and what type does is it tells us what the type of a given value is. 4 00:00:11,955 --> 00:00:17,560 So, for example if we print out the value of type when called with the string "Hello, 5 00:00:17,560 --> 00:00:22,035 world" as an argument then Python is going to tell us that this is a string. 6 00:00:22,035 --> 00:00:25,290 It'll tell us that this isn't int, 7 00:00:25,290 --> 00:00:30,210 and then here if we don't call the type function we get the value itself, 8 00:00:30,210 --> 00:00:36,330 but if we print out the type of 3.2 then we get that this is a float. 9 00:00:36,330 --> 00:00:38,960 So let's run our code and what you'll 10 00:00:38,960 --> 00:00:42,845 see is that when we print out the type of Hello world. 11 00:00:42,845 --> 00:00:47,870 Then Python has a way of telling us that this is a string. 12 00:00:47,870 --> 00:00:53,465 Print out the type of 17 Python is telling us this is an integer. 13 00:00:53,465 --> 00:00:56,990 This is just us printing out the string hello world itself, 14 00:00:56,990 --> 00:01:02,840 but if we print out the type of 3.2 then Python tells us that this is a float, 15 00:01:02,840 --> 00:01:06,170 and this can be especially helpful in situations where 16 00:01:06,170 --> 00:01:09,145 you're not necessarily sure what type something has. 17 00:01:09,145 --> 00:01:13,085 So for example here we have a value 17, 18 00:01:13,085 --> 00:01:16,550 and even though this is a number because it's in quotation 19 00:01:16,550 --> 00:01:20,600 marks the value of this expression is going to be a string. 20 00:01:20,600 --> 00:01:24,560 So the type of this expression is going to print out class str. 21 00:01:24,560 --> 00:01:25,835 Same thing with this. 22 00:01:25,835 --> 00:01:29,330 So even though 3.2 is a float because these are in quotation 23 00:01:29,330 --> 00:01:33,015 marks this overall expression is a string. 24 00:01:33,015 --> 00:01:36,875 So if I run my code then I'll see that both of these are strings. 25 00:01:36,875 --> 00:01:41,260 Now there are few other things to note when working with Python expressions. 26 00:01:41,260 --> 00:01:43,440 First, when creating a string, 27 00:01:43,440 --> 00:01:47,075 as we mentioned, there are multiple ways of creating a string literal. 28 00:01:47,075 --> 00:01:49,445 One is using a single quotes mark. 29 00:01:49,445 --> 00:01:52,040 Another is using double quotation marks. 30 00:01:52,040 --> 00:01:58,430 Another is using three double quotation marks or three single quotation marks. 31 00:01:58,430 --> 00:02:01,175 Now, the important thing to note is that 32 00:02:01,175 --> 00:02:04,440 even though all of these expressions create a string in 33 00:02:04,440 --> 00:02:08,120 a different way if we ask what's the type of each of 34 00:02:08,120 --> 00:02:12,160 these then Python is going to tell us that these are all strings. 35 00:02:12,160 --> 00:02:16,010 So even though we create strings in four different ways 36 00:02:16,010 --> 00:02:20,765 here all of these boil down to the same type in Python, 37 00:02:20,765 --> 00:02:23,310 which is a string. 38 00:02:23,310 --> 00:02:26,750 So another thing to note when creating strings is that sometimes you 39 00:02:26,750 --> 00:02:30,390 want to include single or double quotation marks inside of a string. 40 00:02:30,390 --> 00:02:33,275 So for example I might want to print out 41 00:02:33,275 --> 00:02:40,450 the string 'Bruce's beard'. 42 00:02:40,450 --> 00:02:43,930 Now here you'll note that I have an apostrophe in 43 00:02:43,930 --> 00:02:49,210 Bruce's and when I try to run my code then Python gives me 44 00:02:49,210 --> 00:02:54,070 a syntax error and that's because to Python it thinks that this is the string 45 00:02:54,070 --> 00:02:56,800 because it thinks that this quotation mark starts 46 00:02:56,800 --> 00:03:00,410 the string in that the apostrophe is supposed to end it. 47 00:03:00,410 --> 00:03:03,340 One way to get around this is by using 48 00:03:03,340 --> 00:03:05,500 double quotation marks if we know that we're 49 00:03:05,500 --> 00:03:08,690 going to have an apostrophe inside of our string. 50 00:03:09,870 --> 00:03:13,130 So here this works. 51 00:03:13,130 --> 00:03:19,730 Conversely, if we had a string that we knew would contain double quotation marks, 52 00:03:21,360 --> 00:03:25,190 again if I run this code then I get a syntax error because 53 00:03:25,190 --> 00:03:29,209 Python thinks the string starts here and ends here, 54 00:03:29,209 --> 00:03:35,520 but one way around it is by using single quotation marks to create the string. 55 00:03:36,610 --> 00:03:41,060 If I have a string that might contain single and double quotation marks, 56 00:03:41,060 --> 00:03:44,310 then one way around that is by using triple quotation marks. 57 00:03:44,310 --> 00:03:48,030 So I might say something like," Oh no", 58 00:03:48,030 --> 00:03:53,890 she exclaimed, "Ben's bike is broken!" 59 00:03:56,920 --> 00:04:04,235 So now I can use both double and single quotation marks inside of the string, 60 00:04:04,235 --> 00:04:09,680 and again triple quotation marks allow us to create strings that span several lines. 61 00:04:09,680 --> 00:04:13,940 Another thing to note when creating an integer is that in the US we 62 00:04:13,940 --> 00:04:18,170 often use commas every third digit in larger numbers. 63 00:04:18,170 --> 00:04:23,720 So for example we might indicate 42,500 using a comma like this, 64 00:04:23,720 --> 00:04:27,030 but here if Python sees a comma inside of 65 00:04:27,030 --> 00:04:30,620 the integer it thinks that these are two separate values. 66 00:04:30,620 --> 00:04:36,035 So it thinks that we're printing out 42 and then 500 as separate values. 67 00:04:36,035 --> 00:04:39,140 So when we're creating large numbers in Python we 68 00:04:39,140 --> 00:04:42,810 shouldn't ever use commas to separate out every three digits. 69 00:04:42,810 --> 00:04:50,530 We need to write the integer like this and now we have the number 42500 in one value. 70 00:04:50,530 --> 00:04:53,870 One more thing to note along those lines is that we can call 71 00:04:53,870 --> 00:04:57,215 print with any number of arguments and when we do, 72 00:04:57,215 --> 00:05:00,405 print decides to take every argument and printout 73 00:05:00,405 --> 00:05:03,860 it's value separated by spaces instead of commas. 74 00:05:03,860 --> 00:05:06,830 So here we're printing out all of these values on 75 00:05:06,830 --> 00:05:11,970 one line and then all of these values on the next line. 76 00:05:12,640 --> 00:05:15,425 So let's do a few multiple choice. 77 00:05:15,425 --> 00:05:18,095 How can you determine the type of the variable? 78 00:05:18,095 --> 00:05:24,090 Well, one way to determine the type of the variable is by using the type function. 79 00:05:24,680 --> 00:05:30,285 Next question is what is the data type of: This is what kind of data? 80 00:05:30,285 --> 00:05:35,830 So in other words if we called type on this expression then what would we get? 81 00:05:35,830 --> 00:05:38,585 Well, Python would tell us that this is a string 82 00:05:38,585 --> 00:05:41,645 because it starts and ends with a single quotation mark. 83 00:05:41,645 --> 00:05:44,790 That's all for now. Until next time.7513

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