Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
1 Balas
4351 Tampilan

Hallo,

I want to ask.. How to remove decimal if the value is zero. Example 123,456,789.00 <--- how to remove 00 ?

Thanks

Avatar
Buang
Jawaban Terbai

I think in python you can do something like:

if(num.find(".00")){      #maybe this find method don't works, so see below

int(num)

}


Or directly, if you don't want do the condition:   int(num)

Examples:

num=0.999 -> int(num) -> num=0

num=123.456 -> int (num) -> num=123

Avatar
Buang
Post Terkait Replies Tampilan Aktivitas
1
Sep 24
3302
1
Apr 24
1852
2
Jan 24
1880
Error message Diselesaikan
2
Nov 23
2781
1
Mar 24
2114