mardi 21 avril 2015

How to find the max and min from a string in python?

This is my current program. It's outputting the incorrect max and min. What is missing from my if statement?

def palin():
  max = 0
  min = 50
  numbers = "23","3","4","6","10"
  for x in numbers:

    if x>max:
      max=x
    if x<min:
      min=x

  print max
  print min

Aucun commentaire:

Enregistrer un commentaire