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
The maximum element is =  5

 

Insert floating point numbers only: 1.87
The maximum element is =  8

Subscribe For Daily Updates

100+ Python Pattern Examplespython pattern examples - star patterns, number patterns