Last active
June 24, 2016 20:05
-
-
Save TiagoDanin/f2c6b094efa720791645cfebef7fe7c8 to your computer and use it in GitHub Desktop.
Max Of Three
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'''Max Of Three http://www.practicepython.org/exercise/2016/03/27/28-max-of-three.html | |
Exercise | |
Implement a function that takes as input three variables, and returns the largest of the three. Do this without using the Python max() function! | |
The goal of this exercise is to think about some internals that Python normally takes care of for us. All you need is some variables and if statements!''' | |
num1 = int(raw_input("Put number 1:")) | |
num2 = int(raw_input("Put number 2:")) | |
num3 = int(raw_input("Put number 3:")) | |
result = 0 | |
if result < num1: | |
result = num1 | |
if result < num2: | |
result = num2 | |
if result < num3: | |
result = num3 | |
print('Largest number is: {}'.format(result)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment