Wednesday, August 10, 2022

[FIXED] How can i remove decimal point in python

Issue

I have a variable like follow

a[i] = b

and b is integer number like 2

but if I do print(a[i]), it shows 2.0

Can I remove the decimal point?


Solution

You could use type conversion on your result to convert it to an int and it would work. Without further information about contents of a:

print(int(a[i]))


Answered By - Jax Teller
Answer Checked By - Candace Johnson (PHPFixing Volunteer)

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.