+ 2
How to Find the max of output elements
7 Réponses
+ 8
Павел Сливенко 🇷🇺 ,
what i am missing in this question is a clear task description that explanes how the decision about the number is done. it is this line:
if (len(T1)/2==T1.count('1')):
but it would be more obvious to say explicitly:
> find the length of a substring (T1) based on T, where the number of 1's is equal to the length of T1 divided by 2.
+ 3
The code only outputs 4 numbers. Did you mean to find max of the four or was it something else?
+ 3
Yes, I mean max of the four in this example. It's 90. I need the code that output only maximum value of all that this code produces. Thank you for your help.
+ 2
To max:
a = 4
b = 2
def findTheMax(a, b):
return max(a, b)
To min is min()
+ 1
This code can output any number of elements due to the T value.
+ 1
Can you please confirm my question, what is max value? I'm still unclear on that point ...
+ 1
Okay, Thanks for the confirmation
I was thinking to create a blank `list` before the loop begin, and add variable <L> into that `list` rather than printing it on acreen. We can simply pass that `list` to max() function once the loop completed to get the largest element.