Answers for "find a digit in a number python"

12

number of digits in a number python

n = 1234 //Any Random Number
digits = len(str(n)) //Saves the number of digits of n into the variable digits
Posted by: Guest on March-26-2020
1

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)
Posted by: Guest on October-09-2021
1

how to check if digit in int python

s = set(str(4059304593))
print('2' in s)
Posted by: Guest on January-28-2020

Code answers related to "find a digit in a number python"

Python Answers by Framework

Browse Popular Code Answers by Language