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