Oct-20-2022, 10:36 AM
(Oct-20-2022, 07:17 AM)ibreeden Wrote: But if I understand Skaperen right, he only wants to convert a float to an int if the decimal part equals zero.
So, more like this, you think?
number = float(input("number: ")) if number % 1 == 0: print(f"{int(number)} does not have a decimal place") else: print(f"{number} has a decimal place")
Sig:
>>> import this
The UNIX philosophy: "Do one thing, and do it well."
"The danger of computers becoming like humans is not as great as the danger of humans becoming like computers." :~ Konrad Zuse
"Everything should be made as simple as possible, but not simpler." :~ Albert Einstein
>>> import this
The UNIX philosophy: "Do one thing, and do it well."
"The danger of computers becoming like humans is not as great as the danger of humans becoming like computers." :~ Konrad Zuse
"Everything should be made as simple as possible, but not simpler." :~ Albert Einstein