Зміст курсу
Numeral Systems 101
Numeral Systems 101
Cipher Some Numbers
You are one step closer to becoming a computer geek 🤓
You are going to stand out with such knowledge because working with different programs will be light work. For instance, you are going to have the possibility to correct a lot of mistakes program-wise because you are into all these processes. Probably, you came across built-in python functions, such as min, max. I guess you understand that to deal with them it is better to understand the way it is working. Therefore, the useful thing is to be aware of the "interior" of all actions due to the reason that it will be easy for you to recognize and correct mistakes. However, I don't want to bring any depth into it so let's just dive deeper into binary numbers.
- You need to divide the number by 2 and take down the remainder of the division
- Then you should calculate the received number and implement the first step to it.
- You can stop if division results in 0.
- Rewrite remainders in the reversed order.
The best way to get the idea of binary numbers is to convert them by yourself. The rule is pretty simple! We are going to try it with the number 14.
# Defining decimal number decimal_number = 0 # Creating list for storing the converted binary number binary_number = [] # The text should be realised here due to the reason that further the decimal number will be changed print("The number in decimal numeral system is:", decimal_number) # The conformity for 0 in a decimal numeration system is 0; hence, this condition implemented if decimal_number == 0: binary_number.append(0) # Otherwise, we need to convert it else: # The loop will execute till the number is zero while decimal_number != 0: # Counting the remainder of dividing by two remainder = decimal_number % 2 # Appending the resulting number for creating binary one binary_number.append(remainder) # This operation allows to decrease number twice and work with the integer part of a new one decimal_number = decimal_number // 2 # Reversing the list binary_number.reverse() # Printing the result print("The number in binary numeral system is:", binary_number)
Swipe to show code editor
Convert the decimal number 73 to a binary numeral system. You should follow the instructions and fill the gaps. The explanation why this number was chosen is waiting for you at the end of this chapter.
- Create an empty list for storing
binary
digits. - Print the
decimal_number
. - Define the loop that executes till the
decimal_number
is0
. - Count the remainder of division
decimal_number
by2
. - Append the
remainder
to the list ofbinary numbers
. - Decrease
decimal_number
using integer division by2
. - Make the list of
binary numbers
reversed
. - Print the list of
binary numbers
.
Note
The fans of "Big Bang Theory" may be guessed why this number is special.
Yeah, it is Sheldon Cooper's favorite number. He explains that 73 is the 21st prime number, and its mirror,37, is the 12th prime number which is the mirror of 21, and 21 is the product of 7 and 3. Also, you've proved that last Sheldon's statement that in binary representation it is 1001001 that is a palindrome number.
Дякуємо за ваш відгук!
Cipher Some Numbers
You are one step closer to becoming a computer geek 🤓
You are going to stand out with such knowledge because working with different programs will be light work. For instance, you are going to have the possibility to correct a lot of mistakes program-wise because you are into all these processes. Probably, you came across built-in python functions, such as min, max. I guess you understand that to deal with them it is better to understand the way it is working. Therefore, the useful thing is to be aware of the "interior" of all actions due to the reason that it will be easy for you to recognize and correct mistakes. However, I don't want to bring any depth into it so let's just dive deeper into binary numbers.
- You need to divide the number by 2 and take down the remainder of the division
- Then you should calculate the received number and implement the first step to it.
- You can stop if division results in 0.
- Rewrite remainders in the reversed order.
The best way to get the idea of binary numbers is to convert them by yourself. The rule is pretty simple! We are going to try it with the number 14.
# Defining decimal number decimal_number = 0 # Creating list for storing the converted binary number binary_number = [] # The text should be realised here due to the reason that further the decimal number will be changed print("The number in decimal numeral system is:", decimal_number) # The conformity for 0 in a decimal numeration system is 0; hence, this condition implemented if decimal_number == 0: binary_number.append(0) # Otherwise, we need to convert it else: # The loop will execute till the number is zero while decimal_number != 0: # Counting the remainder of dividing by two remainder = decimal_number % 2 # Appending the resulting number for creating binary one binary_number.append(remainder) # This operation allows to decrease number twice and work with the integer part of a new one decimal_number = decimal_number // 2 # Reversing the list binary_number.reverse() # Printing the result print("The number in binary numeral system is:", binary_number)
Swipe to show code editor
Convert the decimal number 73 to a binary numeral system. You should follow the instructions and fill the gaps. The explanation why this number was chosen is waiting for you at the end of this chapter.
- Create an empty list for storing
binary
digits. - Print the
decimal_number
. - Define the loop that executes till the
decimal_number
is0
. - Count the remainder of division
decimal_number
by2
. - Append the
remainder
to the list ofbinary numbers
. - Decrease
decimal_number
using integer division by2
. - Make the list of
binary numbers
reversed
. - Print the list of
binary numbers
.
Note
The fans of "Big Bang Theory" may be guessed why this number is special.
Yeah, it is Sheldon Cooper's favorite number. He explains that 73 is the 21st prime number, and its mirror,37, is the 12th prime number which is the mirror of 21, and 21 is the product of 7 and 3. Also, you've proved that last Sheldon's statement that in binary representation it is 1001001 that is a palindrome number.
Дякуємо за ваш відгук!
Cipher Some Numbers
You are one step closer to becoming a computer geek 🤓
You are going to stand out with such knowledge because working with different programs will be light work. For instance, you are going to have the possibility to correct a lot of mistakes program-wise because you are into all these processes. Probably, you came across built-in python functions, such as min, max. I guess you understand that to deal with them it is better to understand the way it is working. Therefore, the useful thing is to be aware of the "interior" of all actions due to the reason that it will be easy for you to recognize and correct mistakes. However, I don't want to bring any depth into it so let's just dive deeper into binary numbers.
- You need to divide the number by 2 and take down the remainder of the division
- Then you should calculate the received number and implement the first step to it.
- You can stop if division results in 0.
- Rewrite remainders in the reversed order.
The best way to get the idea of binary numbers is to convert them by yourself. The rule is pretty simple! We are going to try it with the number 14.
# Defining decimal number decimal_number = 0 # Creating list for storing the converted binary number binary_number = [] # The text should be realised here due to the reason that further the decimal number will be changed print("The number in decimal numeral system is:", decimal_number) # The conformity for 0 in a decimal numeration system is 0; hence, this condition implemented if decimal_number == 0: binary_number.append(0) # Otherwise, we need to convert it else: # The loop will execute till the number is zero while decimal_number != 0: # Counting the remainder of dividing by two remainder = decimal_number % 2 # Appending the resulting number for creating binary one binary_number.append(remainder) # This operation allows to decrease number twice and work with the integer part of a new one decimal_number = decimal_number // 2 # Reversing the list binary_number.reverse() # Printing the result print("The number in binary numeral system is:", binary_number)
Swipe to show code editor
Convert the decimal number 73 to a binary numeral system. You should follow the instructions and fill the gaps. The explanation why this number was chosen is waiting for you at the end of this chapter.
- Create an empty list for storing
binary
digits. - Print the
decimal_number
. - Define the loop that executes till the
decimal_number
is0
. - Count the remainder of division
decimal_number
by2
. - Append the
remainder
to the list ofbinary numbers
. - Decrease
decimal_number
using integer division by2
. - Make the list of
binary numbers
reversed
. - Print the list of
binary numbers
.
Note
The fans of "Big Bang Theory" may be guessed why this number is special.
Yeah, it is Sheldon Cooper's favorite number. He explains that 73 is the 21st prime number, and its mirror,37, is the 12th prime number which is the mirror of 21, and 21 is the product of 7 and 3. Also, you've proved that last Sheldon's statement that in binary representation it is 1001001 that is a palindrome number.
Дякуємо за ваш відгук!
You are one step closer to becoming a computer geek 🤓
You are going to stand out with such knowledge because working with different programs will be light work. For instance, you are going to have the possibility to correct a lot of mistakes program-wise because you are into all these processes. Probably, you came across built-in python functions, such as min, max. I guess you understand that to deal with them it is better to understand the way it is working. Therefore, the useful thing is to be aware of the "interior" of all actions due to the reason that it will be easy for you to recognize and correct mistakes. However, I don't want to bring any depth into it so let's just dive deeper into binary numbers.
- You need to divide the number by 2 and take down the remainder of the division
- Then you should calculate the received number and implement the first step to it.
- You can stop if division results in 0.
- Rewrite remainders in the reversed order.
The best way to get the idea of binary numbers is to convert them by yourself. The rule is pretty simple! We are going to try it with the number 14.
# Defining decimal number decimal_number = 0 # Creating list for storing the converted binary number binary_number = [] # The text should be realised here due to the reason that further the decimal number will be changed print("The number in decimal numeral system is:", decimal_number) # The conformity for 0 in a decimal numeration system is 0; hence, this condition implemented if decimal_number == 0: binary_number.append(0) # Otherwise, we need to convert it else: # The loop will execute till the number is zero while decimal_number != 0: # Counting the remainder of dividing by two remainder = decimal_number % 2 # Appending the resulting number for creating binary one binary_number.append(remainder) # This operation allows to decrease number twice and work with the integer part of a new one decimal_number = decimal_number // 2 # Reversing the list binary_number.reverse() # Printing the result print("The number in binary numeral system is:", binary_number)
Swipe to show code editor
Convert the decimal number 73 to a binary numeral system. You should follow the instructions and fill the gaps. The explanation why this number was chosen is waiting for you at the end of this chapter.
- Create an empty list for storing
binary
digits. - Print the
decimal_number
. - Define the loop that executes till the
decimal_number
is0
. - Count the remainder of division
decimal_number
by2
. - Append the
remainder
to the list ofbinary numbers
. - Decrease
decimal_number
using integer division by2
. - Make the list of
binary numbers
reversed
. - Print the list of
binary numbers
.
Note
The fans of "Big Bang Theory" may be guessed why this number is special.
Yeah, it is Sheldon Cooper's favorite number. He explains that 73 is the 21st prime number, and its mirror,37, is the 12th prime number which is the mirror of 21, and 21 is the product of 7 and 3. Also, you've proved that last Sheldon's statement that in binary representation it is 1001001 that is a palindrome number.