Example 99: Function with a Variable Number of Arguments

Learn how to write a function with a variable number of arguments.

We'll cover the following


Write a function that receives a variable number of arguments, where the arguments are the coordinates of the point. Based on the number of arguments received, the function should display the type of shape (for example, a point, line, triangle, etc.) drawn from them.

Try it yourself

Try to solve this question on your own in the code widget below. If you get stuck, you can always refer to the solution provided.

Level up your interview prep. Join Educative to access 70+ hands-on prep courses.