Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 23131

Python. max_of_three using first_result, second_result,

$
0
0

Ok so im an absolut beginner at this and trying Coderslang in Visual Studio.How do i get the highest number from ..._result? It allways just gives me the first one.

first_result = max_of_three(1, -1, 3)print(first_result)second_result = max_of_three(1, 4, 2)print(second_result)third_result = max_of_three(1, 2, 2)print(third_result)

I tried:

def max_of_three(x, y, z):    max = x    if y > max:        max = y    if z > max:        max = z        return maxfirst_result = max_of_three(1, -1, 3)print(first_result)second_result = max_of_three(1, 4, 2)print(second_result)third_result = max_of_three(1, 2, 2)print(third_result)

Result:

3

None

None


Viewing all articles
Browse latest Browse all 23131

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>