# You create and assign a entered value as a string to the variable a
# For example: first you enter 5, it is means that a = "5"
# so you need to convert values to type float or int
a = int(input('Enter a number: '))
b = int(input('Enter a number: '))
c = int(input('Enter a number: '))
d = int(input('Enter a number: '))
e = int(input('Enter a number: '))
f = int(input('Enter a number: '))
# then find max integer or float value (not max asci code of string as in your solution)
list1 = a
list2 = max(a, b,)
list3 = max(a, b, c)
list4 = max(a, b, c, d)
list5 = max(a, b, c, d, e)
list6 = max(a, b, c, d, e, f)
print('Enter a number: ' + str(a) + '\nLargest: ' + str(list1))
print('Enter a number: ' + str(b) + '\nLargest: ' + str(list2))
print('Enter a number: ' + str(c) + '\nLargest: ' + str(list3))
print('Enter a number: ' + str(d) + '\nLargest: ' + str(list4))
print('Enter a number: ' + str(e) + '\nLargest: ' + str(list5))
print('Enter a number: ' + str(f) + '\nLargest: ' + str(list6))
Comments
Leave a comment