1 00:00:00,670 --> 00:00:05,020 In some situations you will want to use a variable's value inside a string. 2 00:00:05,050 --> 00:00:11,260 For example, you might want to use two variables to represent the first name and the last name respectively, 3 00:00:11,260 --> 00:00:16,870 and then combine those values to display someone's well, full name. 4 00:00:16,870 --> 00:00:20,830 So here we will write first name. 5 00:00:21,130 --> 00:00:22,990 Or actually, let's instead of Y. 6 00:00:23,020 --> 00:00:26,320 Let's make manipulations on Oxford Academy's string. 7 00:00:26,320 --> 00:00:27,190 So. 8 00:00:29,300 --> 00:00:30,530 Let's make the. 9 00:00:32,150 --> 00:00:33,140 First name. 10 00:00:33,590 --> 00:00:34,580 First name. 11 00:00:35,720 --> 00:00:38,360 First name here, it's Oxley. 12 00:00:38,360 --> 00:00:42,980 And here last name is Academy. 13 00:00:43,100 --> 00:00:47,480 So now we will we will write full name. 14 00:00:48,170 --> 00:00:49,310 It's going to be. 15 00:00:50,430 --> 00:00:51,090 Here. 16 00:00:51,210 --> 00:00:53,400 F here. 17 00:00:53,460 --> 00:00:54,480 First name. 18 00:00:55,650 --> 00:00:57,780 And last name. 19 00:00:59,120 --> 00:01:02,060 And after that we will print the full name. 20 00:01:04,530 --> 00:01:08,040 Let's increase the text size a little bit so you can see it better. 21 00:01:10,540 --> 00:01:11,620 A thanks. 22 00:01:12,100 --> 00:01:14,380 Let's make the text size 33. 23 00:01:16,100 --> 00:01:17,150 That's perfect. 24 00:01:19,240 --> 00:01:25,660 So here to insert a variable's value into a string. 25 00:01:25,690 --> 00:01:26,000 Oops. 26 00:01:26,800 --> 00:01:32,260 Insert variable's value into a string place the letter F. 27 00:01:32,500 --> 00:01:33,130 Sorry. 28 00:01:33,280 --> 00:01:36,460 Here, place the letter F. 29 00:01:37,230 --> 00:01:42,540 Immediately before opening a quotation mark here. 30 00:01:44,260 --> 00:01:44,590 What? 31 00:01:44,590 --> 00:01:46,390 Braces a random name. 32 00:01:47,490 --> 00:01:48,330 Like this. 33 00:01:49,120 --> 00:01:50,860 But prices around the name. 34 00:01:53,380 --> 00:01:57,700 Or names of any variable you want to use inside the string. 35 00:01:57,700 --> 00:02:05,740 So Python will replicate or replace each variable with its value when the string is displayed. 36 00:02:05,740 --> 00:02:11,020 In this case, it's going to be Oxley and then Academy in the full name. 37 00:02:12,330 --> 00:02:14,160 So the strings are called. 38 00:02:14,210 --> 00:02:18,780 These strings are called F strings here F. 39 00:02:20,250 --> 00:02:21,120 Strings. 40 00:02:24,010 --> 00:02:27,250 F strings and the F here. 41 00:02:27,280 --> 00:02:30,490 The F here is for format. 42 00:02:31,560 --> 00:02:32,250 Format. 43 00:02:34,670 --> 00:02:41,720 Because Python formats the strings by replacing the name of any variable in braces with its value. 44 00:02:42,140 --> 00:02:44,450 So the output here, let's run this here. 45 00:02:44,450 --> 00:02:48,680 Let's print the full name and clear the screen for now. 46 00:02:48,680 --> 00:02:50,690 Now let's run the name here. 47 00:02:50,690 --> 00:02:56,870 And as you can see here, we got the Oxley and Academy in same string. 48 00:02:56,870 --> 00:02:59,300 So you can do a lot with F strings. 49 00:02:59,300 --> 00:03:06,500 For example, you can use F strings to compose complete message using the information associated with 50 00:03:06,500 --> 00:03:08,210 the variables. 51 00:03:08,210 --> 00:03:10,370 So now let's try this. 52 00:03:11,130 --> 00:03:12,420 Now instead of. 53 00:03:13,040 --> 00:03:15,590 And yes, inside print. 54 00:03:16,370 --> 00:03:18,020 Feel that print. 55 00:03:18,330 --> 00:03:19,190 Hello. 56 00:03:20,060 --> 00:03:22,250 And after that we will use. 57 00:03:23,090 --> 00:03:24,010 Full name. 58 00:03:24,230 --> 00:03:25,040 Title. 59 00:03:26,370 --> 00:03:27,540 And that's it. 60 00:03:27,660 --> 00:03:28,980 So now. 61 00:03:29,670 --> 00:03:30,930 The full name. 62 00:03:30,960 --> 00:03:39,600 The full name is used in a sentence that greets the user and after that the title. 63 00:03:39,600 --> 00:03:41,190 So our. 64 00:03:42,230 --> 00:03:42,890 Here. 65 00:03:44,230 --> 00:03:48,200 So our names is going to be uppercase or OC. 66 00:03:49,090 --> 00:03:49,660 Sully. 67 00:03:51,270 --> 00:03:54,090 And again uppercase A. 68 00:03:55,180 --> 00:03:56,200 Academy. 69 00:03:59,060 --> 00:03:59,780 That's it. 70 00:04:01,110 --> 00:04:01,950 So. 71 00:04:03,360 --> 00:04:05,820 No, let's let's run firstly here. 72 00:04:05,820 --> 00:04:08,760 And as you can see here, we got this here. 73 00:04:10,090 --> 00:04:10,690 Hello. 74 00:04:10,720 --> 00:04:12,370 Oxley Academy. 75 00:04:17,340 --> 00:04:21,240 We got these because we have to use this quotation mark. 76 00:04:22,070 --> 00:04:22,910 Not here. 77 00:04:22,910 --> 00:04:28,580 And this quotation mark, not here at the end of this year. 78 00:04:29,820 --> 00:04:31,080 Outside the brace. 79 00:04:31,320 --> 00:04:33,060 Now let's run this. 80 00:04:33,620 --> 00:04:38,270 And as you can see here, we got this as an output. 81 00:04:38,270 --> 00:04:41,480 So you can do a lot with format strings. 82 00:04:41,780 --> 00:04:42,740 So. 83 00:04:44,770 --> 00:04:45,310 Now. 84 00:04:45,460 --> 00:04:48,760 So this quote displays this message as well. 85 00:04:48,760 --> 00:04:55,240 But you signing the message to a variable, We make the final print. 86 00:04:55,720 --> 00:04:57,400 How much simpler here? 87 00:04:57,400 --> 00:05:04,780 So let's instead of this, let's delete this braces, delete this print function. 88 00:05:04,780 --> 00:05:08,380 And now we will write message here. 89 00:05:08,770 --> 00:05:12,970 So we got the first name, last name, full name and message. 90 00:05:13,300 --> 00:05:13,840 All right. 91 00:05:14,700 --> 00:05:22,350 So now we will just print the message and we will get the same output again.