Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

get first digit of number

# Python Program to get the first digit of number

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

# get the first digit
while (num >= 10):
    num = num // 10

# printing first digit of number
print('The first digit of number:', num)
Comment

PREVIOUS NEXT
Code Example
Python :: correlation with target variable python 
Python :: windows instalar python 
Python :: python string: .format() 
Python :: use argparse to call function and use argument in function 
Python :: delete plotted text in python 
Python :: how to reverse list python 
Python :: seaborn orient 
Python :: how to write a function in python 
Python :: python loop 
Python :: base64 python flask html 
Python :: escape brackets in regex python 
Python :: swap two lists without using third variable python 
Python :: defaultdict item count 
Python :: post from postman and receive in python 
Python :: python loop to a tuple 
Python :: python tkinter 
Python :: convert hex rgb to matplotlib color 
Python :: python combine two columns into matrix 
Python :: select each two elements on a list python 
Python :: python == vs is 
Python :: count in python 
Python :: python order number list 
Python :: api testing python 
Python :: python replace list from another dictionary items 
Python :: python power of natural number 
Python :: python while loop 
Python :: pandas get size of each group 
Python :: NumPy invert Syntax 
Python :: shape of variable python 
Python :: python map 
ADD CONTENT
Topic
Content
Source link
Name
5+8 =