Exercise: Determine Maximum of Two Numbers

Write a program that

  • Takes two numbers from the commandline. Remember: commandline arguments can only be strings, so those have to be converted to numbers.

  • Determines the maximum of the numbers.

  • Outputs the maximum.

$ python maximum.py 42 123
123

Dependencies

cluster_python Python Programming: From Absolute Beginner to Advanced Productivity cluster_python_basics Python: The Language Fundamentals cluster_python_exercises Exercises cluster_python_exercises_herdt Exercises (External) python_basics_python_0140_variables Variables python_basics_python_0130_syntax_etc Syntax etc. python_basics_python_0140_variables->python_basics_python_0130_syntax_etc python_basics_python_0150_datatypes_overview Datatypes python_basics_python_0150_datatypes_overview->python_basics_python_0140_variables python_basics_python_0160_boolean Boolean python_basics_python_0160_boolean->python_basics_python_0150_datatypes_overview python_basics_python_0110_blahblah Blahblah python_basics_python_0170_if The if Statement python_basics_python_0170_if->python_basics_python_0160_boolean python_basics_python_0120_helloworld Hello World python_basics_python_0120_helloworld->python_basics_python_0110_blahblah python_basics_python_0130_syntax_etc->python_basics_python_0120_helloworld python_basics_python_0125_running Running Python Programs python_basics_python_0125_running->python_basics_python_0120_helloworld python_basics_python_0139_commandline_argv Commandline Arguments (sys.argv) python_basics_python_0139_commandline_argv->python_basics_python_0130_syntax_etc python_basics_python_0139_commandline_argv->python_basics_python_0125_running python_exercises_herdt_boolean Exercise: Boolean Expressions python_exercises_herdt_boolean->python_basics_python_0160_boolean python_exercises_herdt_max_numbers Exercise: Determine Maximum of Two Numbers python_exercises_herdt_max_numbers->python_basics_python_0140_variables python_exercises_herdt_max_numbers->python_basics_python_0170_if python_exercises_herdt_max_numbers->python_basics_python_0139_commandline_argv python_exercises_herdt_swap Exercise: Swap Two Variables python_exercises_herdt_max_numbers->python_exercises_herdt_swap python_exercises_herdt_swap->python_basics_python_0140_variables python_exercises_herdt_swap->python_basics_python_0150_datatypes_overview python_exercises_herdt_swap->python_basics_python_0120_helloworld python_exercises_herdt_swap->python_exercises_herdt_boolean