Python program to Get Maximum Value of a Floating-Point Number
x = float(input("Insert floating point numbers only: "))
y = str(x)
maxi = -1
for i in range(len(y)):
if y[i] == '.':
continue
elif maxi < int(y[i]):
maxi = int(y[i])
print("The maximum element is = ",maxi)
Output:
|
Insert floating point numbers only: 12.54
Insert floating point numbers only: 1.87 |