DekGenius.com
Home
(current)
Dictionary
BOOKS
LYRICS
CHORD
SCRIPT & CODE EXAMPLE
Karaoke language
Search
Go
SCRIPT & CODE EXAMPLE
CODE EXAMPLE FOR PYTHON
how to take first digit of number python
import math def first_n_digits(num, n): return num // 10 ** (int(math.log(num, 10)) - n + 1)
Source by stackoverflow.com #
PREVIOUS
NEXT
Tagged:
#digit
#number
#python
ADD COMMENT
Topic
COMMENT
Name
8+1 =
Submit