00:01
Hello, welcome to this lesson.
00:01
In this lesson, we'll use python to write a program that will convert this amount values to binary values.
00:14
So this is how we'll do it.
00:15
So for example, if we have a value like 3, what happens is that we divide it by 2 and write the remainder.
00:27
So divided by two we have we have one remainder one okay then now we divide one again by two and it goes like one.
00:47
Okay, so this is what we have.
00:53
All right now let's define function that will make recursive so can make it a small to binary.
01:06
Now it needs a value.
01:08
This is what i'll do.
01:10
I'll check if the value is greater than one.
01:15
It's greater than one.
01:17
I'll call the decimal two binary again and passing the number.
01:23
But this time, we'll divide it by two and only keep the integer parts in it.
01:32
Okay, i don't want to keep a fraction.
01:35
Fact and i will now print the remainder okay so we use a reminder for that and with that remember when we divide by two so that number remain if we divide by two i would want to keep everything in the same line so this is how i will do it now this is exactly what i need so i'll call it from the main function so if name or sue name with this word at user to input a value so say enter the decimal number when they do.
02:48
I would have to convert this that is a string to an integer.
02:53
That's how i will do it and i would pass a number into a number into an integer...