mardi 8 novembre 2016

Pyscripter: How to make if (variable) is decimal statement

My goal is to make it if a/b is a decimal, round up to nearest whole no matter what the decimal is

here is my code:

a=raw_input("a")
b=raw_input("b")

nummeasure=(int)(a)/(int)(b)

if type(nummeasure) is float:
    nummeasure= nummeasure+0.5)

print (nummeasure)

im new to python and my code isnt working so any help would be appreciated

Aucun commentaire:

Enregistrer un commentaire