Answer to Question #83826 in Python for Ella

Question #83826
I don't understand my edhesive program is saying I have a unexcptcted outcome when it looks good to me. Here is the code.


a = input('Enter a number: ')
b = input('Enter a number: ')
c = input('Enter a number: ')
d = input('Enter a number: ')
e = input('Enter a number: ')
f = input('Enter a number: ')


list1 = str(max(a,))
list2 = str(max(a, b,))
list3 = str(max(a, b, c))
list4 = str(max(a, b, c, d))
list5 = str(max(a, b, c, d, e))
list6 = str(max(a, b, c, d, e, f))


print (('Enter a number: ') + a + ('\nLargest: ') + list1)
print (('Enter a number: ') + b + ('\nLargest: ') + list2)
print (('Enter a number: ') + c + ('\nLargest: ') + list3)
print (('Enter a number: ') + d + ('\nLargest: ') + list4)
print (('Enter a number: ') + e + ('\nLargest: ') + list5)
print (('Enter a number: ') + f + ('\nLargest: ') + list6)
1
Expert's answer
2018-12-17T08:39:10-0500
# 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))

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
New on Blog
APPROVED BY CLIENTS