Вопрос

I have not understood why they write round(x[,n]) in syntax, but in codes they write round(10.6987,12) without square brackets before comma i.e, round(10.6987[,12])

Это было полезно?

Решение

The square brackets aren't intended to by typed into your code. They just indicate that n is an optional parameter.

This style is recommended in the Documenting Python guide:

function

Describes a module-level function. The signature should include the parameters, enclosing optional parameters in brackets. Default values can be given if it enhances clarity. For example:

Другие советы

Square brackets are just a convention used to indicate optional arguments.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top