Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # MAXIMUM FUNCTION FOR ALL NUMBERS IN A LIST: WITH > COMPARISON
- def maxvalue(list):
- # filters out only int and float from list:
- list_converted = []
- for j in range(len(list)):
- if type(list[j]) in (int, float):
- list_converted.append(list[j])
- maxvalue = list_converted[0]
- for i in range(len(list_converted)):
- if list_converted[i] > maxvalue:
- maxvalue = list_converted[i]
- print("Your list was:\n" + str(list_converted) + "\nIts maximum numeric value is " + str(maxvalue) + ".")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement