Main.Lab2 History

Hide minor edits - Show changes to markup

February 01, 2010, at 10:27 AM MST by 129.82.44.241 -
Added lines 14-22:

String length comparison

Write a function called string_length_compare that receives two strings as its parameters and return True if they have the same length, and False otherwise. The length of a string is determined using the len built in function. For example:

(:source lang=python:) >>> len("python") 6 (:sourceend:)

January 31, 2010, at 09:28 AM MST by 71.196.160.210 -
Added lines 1-14:

Lab 2

Objectives:

  • Practice the use of functions and conditionals

Maximum of two numbers

Write a function called max2 that returns the maximum of two numbers

Maximum of three numbers

Write a function called max3 that returns the maximum of three numbers. Write two versions of this function: one that does this directly, and one that uses the function max2.