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