how to show the max and min from user input?

2024/10/5 14:52:01

Nevermind

if xmin == 1:print(ymin)

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

Answer

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://en.xdnf.cn/q/119831.html

Related Q&A

To output a string without whitespce

My program:def string_splosion(str):j=1c=len(str)i=0s=while(i<c):s=s+(str[:i+j])i=i+1print sprint("Enter a string:") s=raw_input() string_splosion(s)Sample input:Code Expected output:CCoCo…

Regex replace `a.b` to `a. b`? [duplicate]

This question already has answers here:Python: Replace with regex(2 answers)Closed 6 years ago.I am trying to change all strings of the type a.b to a. b. It should also work if any of the characters ar…

Is there something wrong with this line of Python code?

I tried this line of code, and it kept giving me the SyntaxError.print(/ / - / \ / | * 30, end=\r)^It pointed on the brackets. Any suggestions? Thanks!

TypeError: tuple indices must be integers or slices, not str postgres/python

Hi Im trying to get a timestamp from a row called time in my postgres database, however Im getting the error. Its the second row in the database. The error TypeError: tuple indices must be integers or …

Pandas Python: KeyError Date

I am import into python where it will automatically create a date time object.However I want the first column to be a datetime object in Python. Data looks likeDate,cost 41330.66667,100 41331.66667,101…

How to resample 1 minute data into 15 minute data?

CSV file. df before resample and after applying: df["dateandtime"] = (pd.to_datetime(df.pop("DATE").str.cat(df.pop("TIME"), sep=" "))) df = df.set_index(pd.Datet…

Python Pygame Lighting for Pong

Hey Guys Im writing a little Pong-Game in Pygame and wanted to use a glowing-effect on the Ball and the Bats. But Pygame dosent support this effects and make solid blocks out of it. Is there a way to h…

python - List.remove method not applicable as the function with the map builtin?

Question Can List.remove not be used as the function to apply in the map(function, iterable, ...) builtin? %%timeit import random m = _max = 10000 n = random.randint(1, m)outer = random.sample(populat…

How do I change a sum for string for it to work?

This is my whole program Im working on (with the function not in the right place due to the code needing to be indented) but anyway there is a problem that Im not sure how to fix.How do I change it so …

Convert type str to numerator/ denominator

Im having some trouble converting type str to numbers. I use a separate text-file containing the following numbers 1, 2, 3, 4, 5, 6 and then I import these numbers into python and save them as a list. …