Зміст курсу
Numeral Systems 101
Numeral Systems 101
Welcome on Board!
Hi there!
Have you heard about numeral systems?
If not, I suppose you used to work with one of them, the most popular one. It is called the decimal numeral system and describes all values, that you use in regular life, like 10
,112
,674
or 4
. Indeed, there are three more commonly used systems like binary, octal, and hexadecimal, but we are going to get acquainted with them in the next chapters.
But why decimal? All numbers are ten-based we can simply decompose them to a thousand, hundred and dozens.
Rule
I'm going to explain it explicitly using the number 123
. Imagine that each number has indices and the counting starting from the very right number: here we begin with the number 3
and assign it the index of 0. Subsequently, 2
has an index of 1, and 1
has an index of 2. Therefore, 3->0
, 2->1
, 1->2
. To present a number in decimal representation we should multiply it by the ten raised to the power of index. For instance: 1x10^2=100
, 2x10^1=20
, 3x10^0=3
; or we can say the decomposed number 123 consists of 100, 20, and 3.
# Defining decimal number decimal_number = 123 # Variable for storing the power power = 0 # Printing decimal number print("The initial decimal number is", decimal_number) print("Decomposed decimal number consists of:") # Defining loop that executes till the number is zero while decimal_number != 0: # The remainder of division by 10 allows us to receive the last digit of a number last_digit = decimal_number % 10 # Multiplying last_digit by 10 raised to the relevant power result = last_digit * pow(10, power) #Decreasing decimal number using integer division by 10, allows getting rid of the last digit decimal_number = decimal_number // 10 # Increasing power by 1 power = power + 1 # Printing decomposed number print(result)
Swipe to show code editor
Gained knowledge should be practiced, it is a recipe for success! So now, it is time to present numbers in the decimal numeral system. Try to do it with the number 365🌍 You should follow the algorithm on the right and fill the gaps.
- Define the variable titled
power
and assign0
to it. - Define the loop that executes till the
decimal_number
is0
. - Count the remainder of division
decimal_number
by10
. - Multiply the
last_digit
by the10
raised to the relevant power. - Decrease
decimal_number
using integer division by10
. - Print the
result
.
Once you've completed this task, click the button below the code to check your solution.
Дякуємо за ваш відгук!
Welcome on Board!
Hi there!
Have you heard about numeral systems?
If not, I suppose you used to work with one of them, the most popular one. It is called the decimal numeral system and describes all values, that you use in regular life, like 10
,112
,674
or 4
. Indeed, there are three more commonly used systems like binary, octal, and hexadecimal, but we are going to get acquainted with them in the next chapters.
But why decimal? All numbers are ten-based we can simply decompose them to a thousand, hundred and dozens.
Rule
I'm going to explain it explicitly using the number 123
. Imagine that each number has indices and the counting starting from the very right number: here we begin with the number 3
and assign it the index of 0. Subsequently, 2
has an index of 1, and 1
has an index of 2. Therefore, 3->0
, 2->1
, 1->2
. To present a number in decimal representation we should multiply it by the ten raised to the power of index. For instance: 1x10^2=100
, 2x10^1=20
, 3x10^0=3
; or we can say the decomposed number 123 consists of 100, 20, and 3.
# Defining decimal number decimal_number = 123 # Variable for storing the power power = 0 # Printing decimal number print("The initial decimal number is", decimal_number) print("Decomposed decimal number consists of:") # Defining loop that executes till the number is zero while decimal_number != 0: # The remainder of division by 10 allows us to receive the last digit of a number last_digit = decimal_number % 10 # Multiplying last_digit by 10 raised to the relevant power result = last_digit * pow(10, power) #Decreasing decimal number using integer division by 10, allows getting rid of the last digit decimal_number = decimal_number // 10 # Increasing power by 1 power = power + 1 # Printing decomposed number print(result)
Swipe to show code editor
Gained knowledge should be practiced, it is a recipe for success! So now, it is time to present numbers in the decimal numeral system. Try to do it with the number 365🌍 You should follow the algorithm on the right and fill the gaps.
- Define the variable titled
power
and assign0
to it. - Define the loop that executes till the
decimal_number
is0
. - Count the remainder of division
decimal_number
by10
. - Multiply the
last_digit
by the10
raised to the relevant power. - Decrease
decimal_number
using integer division by10
. - Print the
result
.
Once you've completed this task, click the button below the code to check your solution.
Дякуємо за ваш відгук!
Welcome on Board!
Hi there!
Have you heard about numeral systems?
If not, I suppose you used to work with one of them, the most popular one. It is called the decimal numeral system and describes all values, that you use in regular life, like 10
,112
,674
or 4
. Indeed, there are three more commonly used systems like binary, octal, and hexadecimal, but we are going to get acquainted with them in the next chapters.
But why decimal? All numbers are ten-based we can simply decompose them to a thousand, hundred and dozens.
Rule
I'm going to explain it explicitly using the number 123
. Imagine that each number has indices and the counting starting from the very right number: here we begin with the number 3
and assign it the index of 0. Subsequently, 2
has an index of 1, and 1
has an index of 2. Therefore, 3->0
, 2->1
, 1->2
. To present a number in decimal representation we should multiply it by the ten raised to the power of index. For instance: 1x10^2=100
, 2x10^1=20
, 3x10^0=3
; or we can say the decomposed number 123 consists of 100, 20, and 3.
# Defining decimal number decimal_number = 123 # Variable for storing the power power = 0 # Printing decimal number print("The initial decimal number is", decimal_number) print("Decomposed decimal number consists of:") # Defining loop that executes till the number is zero while decimal_number != 0: # The remainder of division by 10 allows us to receive the last digit of a number last_digit = decimal_number % 10 # Multiplying last_digit by 10 raised to the relevant power result = last_digit * pow(10, power) #Decreasing decimal number using integer division by 10, allows getting rid of the last digit decimal_number = decimal_number // 10 # Increasing power by 1 power = power + 1 # Printing decomposed number print(result)
Swipe to show code editor
Gained knowledge should be practiced, it is a recipe for success! So now, it is time to present numbers in the decimal numeral system. Try to do it with the number 365🌍 You should follow the algorithm on the right and fill the gaps.
- Define the variable titled
power
and assign0
to it. - Define the loop that executes till the
decimal_number
is0
. - Count the remainder of division
decimal_number
by10
. - Multiply the
last_digit
by the10
raised to the relevant power. - Decrease
decimal_number
using integer division by10
. - Print the
result
.
Once you've completed this task, click the button below the code to check your solution.
Дякуємо за ваш відгук!
Hi there!
Have you heard about numeral systems?
If not, I suppose you used to work with one of them, the most popular one. It is called the decimal numeral system and describes all values, that you use in regular life, like 10
,112
,674
or 4
. Indeed, there are three more commonly used systems like binary, octal, and hexadecimal, but we are going to get acquainted with them in the next chapters.
But why decimal? All numbers are ten-based we can simply decompose them to a thousand, hundred and dozens.
Rule
I'm going to explain it explicitly using the number 123
. Imagine that each number has indices and the counting starting from the very right number: here we begin with the number 3
and assign it the index of 0. Subsequently, 2
has an index of 1, and 1
has an index of 2. Therefore, 3->0
, 2->1
, 1->2
. To present a number in decimal representation we should multiply it by the ten raised to the power of index. For instance: 1x10^2=100
, 2x10^1=20
, 3x10^0=3
; or we can say the decomposed number 123 consists of 100, 20, and 3.
# Defining decimal number decimal_number = 123 # Variable for storing the power power = 0 # Printing decimal number print("The initial decimal number is", decimal_number) print("Decomposed decimal number consists of:") # Defining loop that executes till the number is zero while decimal_number != 0: # The remainder of division by 10 allows us to receive the last digit of a number last_digit = decimal_number % 10 # Multiplying last_digit by 10 raised to the relevant power result = last_digit * pow(10, power) #Decreasing decimal number using integer division by 10, allows getting rid of the last digit decimal_number = decimal_number // 10 # Increasing power by 1 power = power + 1 # Printing decomposed number print(result)
Swipe to show code editor
Gained knowledge should be practiced, it is a recipe for success! So now, it is time to present numbers in the decimal numeral system. Try to do it with the number 365🌍 You should follow the algorithm on the right and fill the gaps.
- Define the variable titled
power
and assign0
to it. - Define the loop that executes till the
decimal_number
is0
. - Count the remainder of division
decimal_number
by10
. - Multiply the
last_digit
by the10
raised to the relevant power. - Decrease
decimal_number
using integer division by10
. - Print the
result
.
Once you've completed this task, click the button below the code to check your solution.