How can i print out float if the result have decimal or print out integer if the result have no decimal?
c = input(\"Enter the total cost of purchase: \") ba
Python floats have a built-in method to determine whether they're an integer:
x = 212.50 y = 212.0 f = lambda x: int(x) if x.is_integer() else x print(x, f(x), y, f(y), sep='\t') >> 212.5 212.5 212.0 212