-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,420
  • 1
  • 12
  • 30

1 Answers1

3

try this

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

output :

234
kiranr
  • 1,590
  • 7
  • 24