-4

I need the pick first 3 numbers if input numbers. Example;

23456.43 = 234

7348593.8304853 = 734

1.097493 = 109

27.7481 = 277

How can I do that in Python?

Epsi95
  • 8,832
  • 1
  • 16
  • 34

1 Answers1

3

try this

number  = 23.4563
x  = int(str(number).replace('.', '') [:3])
print(x)

output :

234
kiranr
  • 2,087
  • 14
  • 32