PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Wednesday, August 10, 2022

[FIXED] How can i remove decimal point in python

 August 10, 2022     decimal, integer, python     No comments   

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)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

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

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing