Posts by gedson alves • 1 point
2 posts
-
0
votes5
answers12449
viewsA: How to separate a digit from an integer?
num = 1894 unidade = num // 1 % 10 # 4 dezena = num // 10 % 10 # 9 centena = num // 100 % 10 # 8 milhar = num // 1000 % 10 # 1
pythonanswered gedson alves 1 -
-1
votes6
answers65891
viewsA: How to convert a string variable to int?
a simple way for this below. while True: try: variavel = int(input('Digite um número: ')) break except ValueError: False