how to show the max and min from user input?

北城以北 提交于 2019-12-13 08:56:22

问题


Nevermind

if xmin == 1:
  print(ymin)

I tried using the max and min but I get a typeerror which is 'int' object not iterable.


回答1:


You cannot use min() and max() with integers. It really makes no sense trying to ask a minimum or maximum if computer only has one number to work with. You need to add user inputs into a list like so:

ages = []
ages.append(age)

After you've done this you can use min() and max() methods:

a = min(ages)


来源:https://stackoverflow.com/questions/58676539/how-to-show-the-max-and-min-from-user-input

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!