In this tutorial, we will learn how to **find the 10th digit of a number** using **Python**. Sometimes, we need to perform operations on specific digits of a number, and Python offers a simple and efficient method for this task. By the end of this tutorial, you will be able to write Python code that can extract the 10th digit of any given number.

### Step 1: Accept the number from the user

To accept a number from the user, you can make use of the built-in `input()`

function which can take user input during the execution of the code.

Let’s write the code that takes an integer input from the user:

1 |
number = int(input("Enter the number: ")) |

### Step 2: Calculate the 10th digit of the number

To find the 10th digit of the number, we can use the integer division and modulo operations. First, we will divide the number by 10^9 using the integer division operator (‘//’), and then we will find the remainder when the result is divided by 10 using the modulo operator (‘%’).

Let’s add the code to find the 10th digit of the number:

1 |
tenth_digit = (number // (10**9)) % 10 |

### Step 3: Display the result

Now that we have found the 10th digit of the number, we can display the result using the built-in `print()`

function.

Here is the code to display the result:

1 |
print("The 10th digit is:", tenth_digit) |

### Full Code

Here is the complete code for finding the 10th digit of a number in Python:

1 2 3 |
number = int(input("Enter the number: ")) tenth_digit = (number // (10**9)) % 10 print("The 10th digit is:", tenth_digit) |

### Example Output

Let’s execute the code with a sample input:

Enter the number: 128946732091351 The 10th digit is: 6

## Conclusion

Now you know how to find the 10th digit of a number using Python. By following the steps in this tutorial and understanding the code, you can easily customize this code to extract specific digits from any given number. Happy coding!