1 00:00:00,760 --> 00:00:01,530 All right. 2 00:00:01,660 --> 00:00:04,390 We're almost kind of flying through this. 3 00:00:04,390 --> 00:00:05,680 I know we're going slow here. 4 00:00:05,680 --> 00:00:11,050 But trust me once you get these data types things become a lot easier. 5 00:00:11,050 --> 00:00:16,420 So we're just climbing that mountain so that we can start looking at a higher level at the language 6 00:00:16,510 --> 00:00:19,750 of Python to keep going. 7 00:00:19,750 --> 00:00:26,800 Let's talk about this data type SDR which stands for strings. 8 00:00:26,820 --> 00:00:27,540 We'll see what they are 9 00:00:30,560 --> 00:00:40,530 a string is simply well a piece of text for example a string can be written with quotation marks. 10 00:00:40,640 --> 00:00:41,870 And I can say hi. 11 00:00:42,230 --> 00:00:44,570 Hello there. 12 00:00:44,570 --> 00:00:46,080 And that is a string. 13 00:00:46,130 --> 00:00:49,110 You see that the color changed here and my editor. 14 00:00:49,130 --> 00:00:52,490 I can also make strings with double quotes. 15 00:00:53,390 --> 00:00:57,350 So once again this is also a valid string. 16 00:00:58,010 --> 00:00:59,690 And I can put anything I want in here. 17 00:00:59,690 --> 00:01:01,490 I can do numbers if I wanted to. 18 00:01:01,490 --> 00:01:02,720 Exclamation marks. 19 00:01:02,900 --> 00:01:10,820 It's just a piece of text you can think of it as a sentence for now and if I do the type function here 20 00:01:10,970 --> 00:01:16,760 remember these brackets to note that we want to perform some sort of action which is we're using the 21 00:01:16,760 --> 00:01:19,280 type action that Python gives us. 22 00:01:19,280 --> 00:01:21,790 And if I click Run you see that. 23 00:01:22,080 --> 00:01:30,350 Oh and remember we have to print it out it is also let's do print so that we can see the display and 24 00:01:30,350 --> 00:01:33,470 I click Run you see that it's SDR. 25 00:01:33,530 --> 00:01:36,300 It's a type of string. 26 00:01:36,320 --> 00:01:39,380 Now we can use this in important ways. 27 00:01:39,440 --> 00:01:47,910 For example imagine you're creating a log in form and we want to collect somebodies username and password. 28 00:01:48,100 --> 00:01:57,370 Well we can have user name variable that we assign let's say some sort of user name let's call it super 29 00:01:57,730 --> 00:02:04,370 coder and then password can be super secret. 30 00:02:04,740 --> 00:02:09,630 And now we have these variables usernames and passwords that we can use throughout our program such 31 00:02:09,630 --> 00:02:12,800 as to check if a password exists. 32 00:02:12,900 --> 00:02:19,820 And remember I can use single quotes or double quotes but there's a third way that we can write strings 33 00:02:19,910 --> 00:02:20,470 in Python. 34 00:02:21,410 --> 00:02:25,210 And this well is used for long strings. 35 00:02:25,250 --> 00:02:28,140 So let's just create a variable long string. 36 00:02:28,340 --> 00:02:33,990 And while we can do here is three single quotes in a row like this. 37 00:02:34,430 --> 00:02:43,640 And then here I can just say wow maybe so a pair of eyes of somebody that's really impressed. 38 00:02:43,640 --> 00:02:48,640 And let's go with a mouth that actually kind of looks like here. 39 00:02:48,930 --> 00:02:49,830 All right. 40 00:02:49,910 --> 00:02:52,520 And then I finish it off with three single quotes. 41 00:02:52,550 --> 00:03:07,200 Again so now if I print the long string and I click Run look at that my little weird emoji face is printed. 42 00:03:07,200 --> 00:03:14,010 So the three single quotes is four long strings that I can keep going on multiple lines for example. 43 00:03:14,010 --> 00:03:15,740 I can't do this with a single quote. 44 00:03:15,750 --> 00:03:21,360 You see that the orange color is now gone because python is going to say this is a new line. 45 00:03:21,360 --> 00:03:28,080 And this is another line and it's going to give me an error because well a caret with a quote doesn't 46 00:03:28,080 --> 00:03:29,160 mean anything. 47 00:03:29,160 --> 00:03:35,640 But if we use three single quotes you can see that we can do multi line strings and this is really useful 48 00:03:35,640 --> 00:03:39,870 if you want to have maybe long sentences and paragraphs. 49 00:03:39,870 --> 00:03:46,830 Now with a string we use we can do some cool things that we saw in the numbers videos. 50 00:03:46,920 --> 00:03:59,170 What if I had something like this Let's say I wanted to grab the first name of a user just give my own 51 00:03:59,170 --> 00:04:06,470 name here and then last name and again my super hard to pronounce last name. 52 00:04:06,570 --> 00:04:11,130 Could we do something like this where we have a full name. 53 00:04:11,130 --> 00:04:29,130 Equals to first name plus last name and then if we print here the full name like this should this work. 54 00:04:29,150 --> 00:04:30,160 Well let's have a look. 55 00:04:30,170 --> 00:04:36,060 Let me remove this part of here just so we have nice and clean looking code. 56 00:04:36,200 --> 00:04:38,790 And if I click Run. 57 00:04:39,010 --> 00:04:39,910 There you go. 58 00:04:39,910 --> 00:04:46,090 My name is printed but you see that there's no spaces here because we're going to use the addition sign 59 00:04:46,120 --> 00:04:48,300 to attach Andre to Nagoya. 60 00:04:48,330 --> 00:04:50,470 But you can see that there's no spaces here. 61 00:04:50,530 --> 00:04:59,780 So I can add a space if I wanted to or I can just simply create another string inside of here just like 62 00:04:59,780 --> 00:05:06,990 this and then add a spacing between so we're just using the plus sign which we've seen in the numbers 63 00:05:07,800 --> 00:05:16,880 videos but instead to add strings together and now if I click Run you see that I got the space because 64 00:05:16,910 --> 00:05:25,090 I'm adding a space in here and between the names very very cool but there's a few more neat things that 65 00:05:25,090 --> 00:05:26,200 we can do with strings. 66 00:05:26,200 --> 00:05:28,660 So let's take a break and I'll see you in the next video.