“Como encontrar 1 dígito em Python” Respostas de código

Como encontrar 1 dígito em 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)
Disgusted Dunlin

string de dígitos python

import string

print(string.digits)
>> "0123456789"
Open Ocelot

Respostas semelhantes a “Como encontrar 1 dígito em Python”

Perguntas semelhantes a “Como encontrar 1 dígito em Python”

Mais respostas relacionadas para “Como encontrar 1 dígito em Python” em Python

Procure respostas de código populares por idioma

Procurar outros idiomas de código