Currently I am learning Python, and I hope someone can kindly help me. I tried to use sort() to sort a specific list ascending, but when I try this example its outputs is wrong.
Number_list[9,5,13]
Number_list.sort()
print Number_list
The result that I have is : ['13', '5', '9']
and it should be : ['5', '9', '13']
I am trying to write program that show the maximum odd number, and i write the code as following:
Number_list = []
print "Enter first number:"
Number_list.append (raw_input());
print "Enter second number:"
Number_list.append (raw_input());
print "Enter third number:"
Number_list.append (raw_input());
Number_list.sort()
if int(Number_list[2]) % 2 != 0 :
print Number_list[2]
elif int(Number_list[1]) %2 != 0:
print Number_list[1]
elif int(Number_list[0]) % 2 != 0:
print Number_list[0]
else:
print "There is no Odd number"
Number_listto the list[9,5,13]in your first line? Did you forget=?