WEBVTT

00:00.080 --> 00:01.120
Welcome back.

00:01.120 --> 00:02.840
Now let's do a practice.

00:02.840 --> 00:03.640
Exercise.

00:03.840 --> 00:10.040
The task ask the user for two numbers then display their sum.

00:10.040 --> 00:12.880
So we need to ask the user for two numbers.

00:13.120 --> 00:16.720
Make the sum and display the result.

00:16.760 --> 00:26.400
The first step is to pause the video, think about it and write your on your notebook in Google Colab

00:26.400 --> 00:29.200
and try to run the file by your own.

00:29.240 --> 00:31.360
I think you solve it well.

00:31.360 --> 00:34.320
So let me start with step one.

00:34.320 --> 00:39.680
Get input Num1 equals to input function.

00:39.880 --> 00:45.240
Enter the first number and num2 equals to input.

00:45.280 --> 00:47.320
Enter the second number.

00:47.360 --> 00:56.680
Then we need to calculate the sum total equals to num one plus num two okay.

00:57.040 --> 01:00.400
The third step is to display the result.

01:00.400 --> 01:05.480
Here we are going to use print f the formatted string.

01:05.480 --> 01:08.560
And here set the sum of number one.

01:08.560 --> 01:11.760
And number two is total okay.

01:11.960 --> 01:19.830
So I used the concatenation and the formatted string, the Num1 and Num2 is total.

01:19.990 --> 01:25.830
And here we used the variables to do the arithmetic operation.

01:25.830 --> 01:30.630
And here we used the input function to get the input from the user.

01:30.670 --> 01:31.790
Run the cell.

01:31.990 --> 01:34.910
Enter the first number 55.

01:34.950 --> 01:38.990
Enter the second number 15 and hit enter.

01:39.190 --> 01:43.710
The sum of 55 and 15 is this concatenation.

01:43.710 --> 01:49.670
And this is not true because it's doing a concatenation of strings.

01:49.910 --> 01:57.350
We didn't convert the strings into integer and do this concatenation.

01:57.350 --> 02:05.150
So here in order to do that, in order to solve this problem we need to convert it using the integer

02:05.150 --> 02:05.990
function.

02:06.230 --> 02:09.590
Integer and surround this variable.

02:09.590 --> 02:18.110
So here we are converting the number one and number two into integers and store them into the total.

02:18.110 --> 02:27.230
In order to do this summation again 5515 and the result is 70.

02:27.270 --> 02:37.870
So I used this exercise in order to clarify the importance of paying attention to the data types.

02:38.110 --> 02:41.070
So data types are very crucial guys.

02:41.230 --> 02:50.830
Any miss, any mistake, any error in converting and getting the correct data type you want, the result

02:50.870 --> 02:52.470
will be wrong.

02:52.710 --> 02:57.750
So as you see here, we have an error in data types.

02:57.750 --> 03:00.230
We have concatenation of two strings.

03:00.510 --> 03:04.550
It gives us 5515.

03:04.550 --> 03:07.390
And the result the correct result is 70.

03:07.430 --> 03:09.590
So it was concatenation of strings.

03:09.830 --> 03:16.230
When we convert them into integers the result becomes true.

03:16.510 --> 03:18.910
So guys please pay attention.

03:18.910 --> 03:21.030
This is a very good example.

03:21.270 --> 03:30.990
It may be very simple, but it it summarizes all the previous concepts and all the tricks that we,

03:31.350 --> 03:34.110
we have in data types.

03:34.110 --> 03:39.350
I want from you to write this down and pay attention to data types.

03:39.510 --> 03:44.590
How to convert between types and how to get input from the user.
