Foundations of Python

You are currently auditing this course.
59 / 134

Built-in Functions

Python provides you with certain built-in functions. For eg,

  • len - It returns how many items are in its argument. If the argument to len is a string, it returns the number of characters in the string.

    len("myname")
    

    It returns the length as 6.

  • min - It returns the smallest value in the list or a string

    min("python")
    

    It returns the character 'h'.

  • max - It returns the largest value in the list or a string. (We will explain the list data type later in the course)

    max(['p','y','t','h','o','n'])
    

    It returns the element 'y'.

These functions are not only limited to strings. They can operate on any set of values, as we will see in later topics.

You should treat the names of built-in functions as reserved words (i.e., avoid using "max" as a variable name).

INSTRUCTIONS
  • Calculate the length of "cloudxlab" using len function and enter

  • Calculate the element with the maximum value in "cloudxlab" using max and enter

  • Calculate the element with minimum value in "cloudxlab" using min and enter


No hints are availble for this assesment

Answer is not availble for this assesment

Loading comments...