CodePudding user response:
# # judgment should be in front of the float, string, or can't run, suggest another glue code block,num="0"
Max=0
While (num!="#") :
Num=input (' end of input value, # ')
If num=="#" :
Break
The else:
Num=float (num)
If num> Max:
Max num=
Print (' maximum values for {: 2 f} '. The format (Max))
CodePudding user response:
?? Thank you for your ideas better than my clearCodePudding user response:
Max is built-in keywords, when the variable name is not recommended!In addition, as to optimize program and exception handling are needed!
Max_digit=0
While True:
Num=input (' input values, # end:)
If num=="#" :
Break
Try:
Num=float (num) # need exception handling
If num & gt; Max_digit:
Max_digit num=
Except:
Print (" current input is not value!" )
Print (f 'maximum values for {max_digit: 2 f}')