[Python] How to take the nth digit of a number in python

Discussão em 'Python' iniciado por Stack, Julho 26, 2025.

  1. Stack

    Stack Membro Participativo

    I want to take the nth digit from an N digit number in python. For example:

    number = 9876543210
    i = 4
    number # should return 6


    How can I do something like that in python? Should I change it to string first and then change it to int for the calculation?

    Continue reading...

Compartilhe esta Página