[image] James Marshall: The code for finding the average was given to me, and the exercise was to add code to find the maximum. The existing code was, presumably, provided as a model that you are expected to understand in order to see some basic tools available to you, so that you can then usโ€ฆ Answer from kknechtel on discuss.python.org
๐ŸŒ
Note.nkmk.me
note.nkmk.me โ€บ home โ€บ python
Maximum and Minimum float Values in Python | note.nkmk.me
August 11, 2023 - You can obtain the maximum representable float value with sys.float_info.max. e+XXX means 10 to the power of XXX.
Discussions

how to get the max value if that is a float?
The error message sounds like you are giving max() function only 1 number... It can't find the max if you only give it one number... >>> max([1.5, 2763.2]) 2763.2 >>> max(1.5) Traceback (most recent call last): File "", line 1, in TypeError: 'float' object is not iterable More on reddit.com
๐ŸŒ r/learnpython
2
2
December 6, 2022
How do I get max value of np.float32?
The maximum value of a float32 is infinity. More on reddit.com
๐ŸŒ r/learnpython
5
1
March 31, 2021
floating point - Python: Return max float instead of infs? - Stack Overflow
import sys def noInf(f): def ... y): return x*y print(myMult(sys.float_info.max, 2)) # prints 1.79769313486e+308 ... Sign up to request clarification or add additional context in comments. ... I don't know about 'replacing' infinity value, but what about using min... More on stackoverflow.com
๐ŸŒ stackoverflow.com
Help understanding this 'float' object is not callable error
That's not what I get, which is TypeError: 'float' object is not subscriptable on the line where you assign to r. The result of m.e**(2*x) is a number, not a list and you can't use [] with a number. y[x+h] is nonsense. It looks like you're thinking of these assignment statements as if they were equations, but they're not. (That's not an uncommon mistake, because programming often borrows concepts and notation from mathematics, but not in this case.) For example, if you wrote y = x**4, that means "take the current value of x, raise is to the fourth power, and assign the result to y." It does not mean that y is now a function that can be called to raise any x to the fourth power, as would be the case if you were in a mathematics class and wrote y(x) = x4 on the board. If you want that, you need to explicitly define y as a function (i.e. with def or a lambda.) More on reddit.com
๐ŸŒ r/learnpython
7
5
October 11, 2015
๐ŸŒ
Python.org
discuss.python.org โ€บ python help
Finding max value in a series of floats - Python Help - Discussions on Python.org
April 15, 2024 - I am trying to write code that takes a row of floats from a csv file, representing the average temperature in a given month over the course of 70 years, and returns the highest float value of them all. When I print the variable holding the float values, in this case val, I get something similar ...
๐ŸŒ
Spark By {Examples}
sparkbyexamples.com โ€บ home โ€บ python โ€บ find maximum float value in python
Find Maximum Float Value in Python - Spark By {Examples}
May 31, 2024 - How to find the maximum float value in Python? You can find the maximum value of the float data type using the sys.float_info module or the finfo()
๐ŸŒ
DEV Community
dev.to โ€บ frankkk โ€บ python-tips-floatinf-269h
Python Tips- Maximum Value float('inf') - DEV Community
February 3, 2024 - For the float, we max value is sys.float_info.max. for the integer, we can use the value sys.maxsize. But Integer (int) has no max limit in Python 3, from the source code in C language, the int object is defined variable size, that is why it ...
๐ŸŒ
Reddit
reddit.com โ€บ r/learnpython โ€บ how to get the max value if that is a float?
r/learnpython on Reddit: how to get the max value if that is a float?
December 6, 2022 -

Hi, I have calculated some values and now need the program to print which is the largest. The problem is that these numbers are floats and I get an error: TypeError: 'float' object is not iterable when using the max function. And I can't change it to int for example, because I need to include numbers after the comma. I would be really grateful if someone could help me.

Find elsewhere
๐ŸŒ
W3Resource
w3resource.com โ€บ python-interview โ€บ what-is-the-maximum-and-minimum-value-for-an-int-float-and-string-data-type-in-python.php
Exploring data type limits in Python
August 12, 2023 - On most platforms, the minimum positive nonzero value is approximately 2.2250738585072014e-308, and the maximum value is approximately 1.7976931348623157e+308. Python's float data type has 15-17 decimal digits of precision.
๐ŸŒ
Finxter
blog.finxter.com โ€บ setting-a-python-float-to-its-maximum-possible-value
Setting a Python Float to Its Maximum Possible Value โ€“ Be on the Right Side of Change
February 25, 2024 - An example input would be the initiation of a variable, and the desired output is that this variable holds the largest possible float value that Python can handle. The most straightforward way to set a float to the maximum value in Python is by using float('inf'), which creates a floating-point ...
๐ŸŒ
Finxter
blog.finxter.com โ€บ home โ€บ learn python blog โ€บ integer and float maximums in pythonโ€™s max() function
Integer and Float Maximums in Python's Max() Function - Be on the Right Side of Change
September 15, 2019 - print(max([5, 10, 10.0])) # 10 print(max([5, 10.0, 10])) # 10.0 ยท It simply returns the highest value in an iterable. Note that many advanced coders worry that we cannot compare an int with a float because of limited floating point precision because they know the following example: print(0.3+0.3+0.3 == 0.9) # False print(0.3+0.3+0.3) # 0.8999999999999999 ยท This is not an issue when comparing integers with โ€œinteger-likeโ€ floats. Python floats can represent integers perfectly fine.
๐ŸŒ
Iditect
iditect.com โ€บ faq โ€บ python โ€บ what-is-the-maximum-float-in-python.html
What is the maximum float in Python?
Running this code will print the maximum finite float value, which is typically 1.8 x 10^308 on most Python implementations. Keep in mind that this value may vary slightly depending on the platform and Python version you are using.
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python-min-max-value-in-float-string-list
Python | Min/Max value in float string list - GeeksforGeeks
April 8, 2023 - Use the np.max() function to get the maximum value from the float_arr array and assign it to a variable max_val. Print the result using the print() function. The minimum value and maximum value are printed using the variables min_val and max_val ...
๐ŸŒ
Reddit
reddit.com โ€บ r/learnpython โ€บ how do i get max value of np.float32?
How do I get max value of np.float32? : r/learnpython
March 31, 2021 - The maximum value of a float32 is infinity. ... You're not wrong Walter. You're just an asshole. ... Not in theory, there is a literal value of infinity that can be encoded as a float. ... I'm 37 and looking for a complete career change. ... Started MOOC 2026 Python Programming today Module ...
๐ŸŒ
w3resource
w3resource.com โ€บ python-exercises โ€บ python-basic-exercise-123.php
Python: Determine the largest and smallest integers, longs, floats - w3resource
May 17, 2025 - Float value information: sys.float_info(max=1.7976931348623157e+308, max_exp=1024, max_10_exp=308, min=2.2250 738585072014e-308, min_exp=-1021, min_10_exp=-307, dig=15, mant_dig=53, epsilon=2.220446049250313e-16, radix=2 , rounds=1) Integer ...
๐ŸŒ
Codemia
codemia.io โ€บ home โ€บ knowledge hub โ€บ what is the maximum float in python?
What is the maximum float in Python? | Codemia
September 24, 2025 - Python float values are usually implemented as IEEE 754 double-precision numbers. That gives a large but finite range, so there is a maximum representable finite float before arithmetic overflows to infinity.
๐ŸŒ
Berkeley
pythonnumericalmethods.studentorg.berkeley.edu โ€บ notebooks โ€บ chapter09.02-Floating-Point-Numbers.html
Floating Point Numbers โ€” Python Numerical Methods
The Python float does not have sufficient precision to store the + 2 for sys.float_info.max, therefore, the operations is essentially equivalent to add zero.
๐ŸŒ
Pythontic
pythontic.com โ€บ containers โ€บ list โ€บ max
max() function of list in Python | Pythontic.com
The max() function returns the largest of the elements present in a Python list. The example creates a list of floating point numbers and prints the largest of them.
๐ŸŒ
Boot.dev
boot.dev โ€บ lessons โ€บ 9a942c38-7ad9-40b7-8f4b-96b3f71d5de2
Learn Python for Beginners: Find Max | Boot.dev
Instead of initializing a base value like 0 or -100000, we can use float("-inf") to represent negative infinity. Because every value will be greater than negative infinity, we can use it as a starting point to help us achieve our goal of finding ...
๐ŸŒ
Linux Hint
linuxhint.com โ€บ python-max-function
Linux Hint โ€“ Linux Hint
Linux Hint LLC, [email protected] 1210 Kelly Park Circle, Morgan Hill, CA 95037 Privacy Policy and Terms of Use