[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 - See the official documentation for a list of items and their explanations. Each item corresponds to a floating point constant defined in the standard header file float.h in the C language. You can obtain the maximum representable float value with sys.float_info.max.
Discussions

Finding max value in a series of floats
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 ... More on discuss.python.org
🌐 discuss.python.org
11
0
April 15, 2024
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
I could put in checks for every time an inf might pop up, or wrap each calculation in a function that rounds inf down to the desired float. More on stackoverflow.com
🌐 stackoverflow.com
🌐
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 ...
🌐
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()
🌐
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 to: 10.56 12.35 11.35 etc.
🌐
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.
Find elsewhere
🌐
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.

🌐
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 ...
🌐
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.
🌐
GeeksforGeeks
geeksforgeeks.org › python › 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 ...
🌐
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.
🌐
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 ...
🌐
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.
🌐
Statistics Globe
statisticsglobe.com › home › python programming language for statistics & data science › print lowest & highest float in list in python (3 examples)
Print Lowest & Highest Float in Python List | Smallest / Largest Item
May 4, 2023 - Finally, the lowest and highest values are found by the min() and the max() functions, respectively, and printed into the console. Easy! This method shows how to use a for loop to print the lowest and highest float values in a list.
🌐
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 ...
🌐
Real Python
realpython.com › lessons › find-maximum-number-solution
Find the Maximum Number (Solution) (Video) – Real Python
02:45 The parameter that we are interested in is called float_info, and it shows a number of low-level details about the floating-point data type in Python, including max_10_exp, which is equal to 308 that we found manually.
Published: November 7, 2023
🌐
Codemia
codemia.io › home › knowledge hub › what is the maximum float in python?
What is the maximum float in Python? | Codemia
September 24, 2025 - Using float for financial or high-precision decimal calculations. The maximum finite Python float is available as sys.float_info.max.