Answer to Question #350137 in Python for Darkninja

Question #350137

: Create a python function that will accept 7 numbers with decimal values and wont accept value if it isn't a float value. After accepting the values, determine the number with the highest values among the given, and then return that value for printing.


1
Expert's answer
2022-06-13T08:26:58-0400
num_list = []
def number():
    while len(num_list) < 7:
        a = input("Enter float number: ")
        if '.' in a:
            try:
                num_list.append(float(a))
            except ValueError:
                print("Error! Enter float number!")
        else:
            print("Error! Enter float number!")
number()
print(max(num_list))

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS