예제 #1
0
파일: ex2.py 프로젝트: skokal01/python
def max_of_three(first, second, three):
    largest = max(first, second)
    return max(largest, three)
예제 #2
0
def max_of_three(a, b, c):
    max_temp = max(a, b)
    return max(max_temp, c)
예제 #3
0
def max_of_three(a, b, c):
    max_temp = max(a, b)
    return max(max_temp, c)
예제 #4
0
def find_longest_word(words):
    return max(map(len, words))
예제 #5
0
def find_longest_word(words):
    return max(map_list_to_len(words))
예제 #6
0
Use the if-then-else construct available in Python.
(It is true that Python has the max() function built in, but writing it yourself is nevertheless a good exercise.)
"""


def max(a, b):
    if a > b:
        return a
    elif b > a:
        return b
    else:
        return None


if __name__ == "__main__":
    print max(2, 5)
    print max(5, 2)
    print max(5, 5)

###########ex2
#!/usr/bin/env python

"""
Define a function max_of_three() that takes three numbers as arguments and returns the largest of them.
"""

from ex1 import max


def max_of_three(a, b, c):
    max_temp = max(a, b)