Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

how to find 1 st digit in python

# Python Program to get the first digit of number

# take input
num = int(input('Enter any Number: '))

# convert int to string
num_str = str(num)

# get the first digit
first_digit = num_str[0]

# printing first digit of number
print('The first digit of number:', first_digit)
Source by www.knowprogram.com #
 
PREVIOUS NEXT
Tagged: #find #st #digit #python
ADD COMMENT
Topic
Name
6+3 =