WEBVTT 00:02.430 --> 00:05.380 Welcome, I prepared the mini challenge for you. 00:05.580 --> 00:06.360 Let's take a look. 00:07.780 --> 00:10.520 Your task is to display random words. 00:11.200 --> 00:11.890 Let me show you. 00:13.270 --> 00:16.190 When you run the program, it should ask you for a name. 00:16.690 --> 00:17.520 Let's give it a name. 00:19.530 --> 00:26.310 As you can see, each time I ran the program, it displays a random mood you need to store these moods 00:26.310 --> 00:30.530 in an area that you should randomly fetch and print one of them. 00:30.570 --> 00:31.970 OK, it's that simple. 00:33.020 --> 00:38.660 As always, you can find this exercise and its solution in the course of depositary. 00:39.830 --> 00:45.110 OK, now please pass the video here and try to solve this challenge. 00:45.200 --> 00:48.410 I'll give you the solution also in this lecture, by the way. 00:51.460 --> 00:53.520 All right, let's take a look at the solution. 00:55.530 --> 00:59.100 First, I'm going to get the command line arguments like this. 01:01.350 --> 01:07.790 And then I'm going to check whether the user has provided a name or not, if not, I'm going to print 01:07.800 --> 01:09.150 a usage message like this. 01:10.700 --> 01:12.520 And then I'm going to exit from the program. 01:13.340 --> 01:15.860 OK, let me start the user name in this variable. 01:16.860 --> 01:22.290 All right, now I'm going to start the mood in a string using the ellipses like this. 01:24.240 --> 01:30.870 So using an ellipsis here is perfect for this use case, so I don't need to count the number of mood 01:30.870 --> 01:33.690 swings myself, go does that for me. 01:34.840 --> 01:37.960 Then I'm going to add a few more mouths like this. 01:38.920 --> 01:41.110 Let's also add some negative moods. 01:42.350 --> 01:48.680 I need to display random moods, right, so I need to see the random number generator first. 01:50.330 --> 01:55.940 Then I'm going to fetch a random number between zero and the length of the mood's like this. 01:57.010 --> 02:01.800 This will give me a random index number so I can print a random mood from the mouse. 02:01.860 --> 02:08.230 Right now I'm going to print them out first with the name of the user and then with a random. 02:10.440 --> 02:10.930 Cool. 02:11.010 --> 02:11.760 Let's run it now. 02:13.200 --> 02:16.740 Let's run it without a name first, good, it works. 02:17.580 --> 02:20.160 Now let's run it with a name like this. 02:21.320 --> 02:21.750 Cool. 02:21.800 --> 02:22.440 I like it. 02:23.150 --> 02:25.800 All right, that's all for this mini exercise. 02:25.880 --> 02:26.900 See in the next picture.