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

Wednesday, July 20, 2022

[FIXED] How can I check whether or not the value after the decimal of an integer is equal to zero

 July 20, 2022     integer, python     No comments   

Issue

How can I check weather or not the value after the decimal of an integer is a zero

a = 17.3678

if a???:
  print("the value after the decimal point is zero")
else:
  print("the value after the decimal point is not zero")

Solution

You can use the split method:

a = 17.3678
a = str(a)
valueAfterPoint = a.split('.')[1]
valueAfterPoint = int(valueAfterPoint)

if valueAfterPoint == 0:
  print("the value after the decimal point is zero")
else:
  print("the value after the decimal point is not zero")


Answered By - Tom
Answer Checked By - Willingham (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