Returns number rounded to ndigits precision after the decimal point. If ndigits is omitted or is None, it returns the nearest integer to its input. It is a built-in Indie function (similar to Python’s).
number
float
required
Number on which the function will be calculated.
round
(number, ndigits) -> float
Returns number rounded to ndigits precision after the decimal point. If ndigits is omitted or is None, it returns the nearest integer to its input. It is a built-in Indie function (similar to Python’s).
Cast constructor for built-in Indie type. Returns a bool value, i.e. one of True or False. The argument is converted using the standard Python’s truth testing procedure.
x
bool
required
Value to cast from.
__init__
(x) -> None
Cast constructor for built-in Indie type. Returns a bool value, i.e. one of True or False. The argument is converted using the standard Python’s truth testing procedure.
x
int
required
Value to cast from.
__init__
(x) -> None
Cast constructor for built-in Indie type. Returns a bool value, i.e. one of True or False. The argument is converted using the standard Python’s truth testing procedure.
x
float
required
Value to cast from.
__init__
(x) -> None
Cast constructor for built-in Indie type. Returns a bool value, i.e. one of True or False. The argument is converted using the standard Python’s truth testing procedure.
x
str
required
Value to cast from.
__init__
(x) -> None
Cast constructor for built-in Indie type. Returns a bool value, i.e. one of True or False. The argument is converted using the standard Python’s truth testing procedure.
Method __add__ should never be called directly, instead list1 + list2 syntax should be used.
__mul__
(n) -> list[T]
Returns a concatenation of the list with n its copies.
n
int
required
How many copies of the list to concatenate.
Example
nums1 =[40,41]nums2 = nums1 *3# this implicitly calls `nums1.__mul__(3)`# and now `nums2` is [40, 41, 40, 41, 40, 41]
Method __mul__ should never be called directly, instead lst * n syntax should be used.
Example
# examples of list creation:a =[1,2,3]# `a` has type `list[int]`b =[1,2,3,4.2]# `b` has type `list[float]`c =["a","b","c"]# `c` has type `list[str]`d =[(1,"a"),(2,"b"),(3,"c")]# `d` has type `list[tuple[int, str]]`e =[0,1,2,3,4,5,6,7]f = e[2:5]# `f` is `[2, 3, 4]`g = e[:5]# `g` is `[0, 1, 2, 3, 4]`h = e[2:]# `h` is `[2, 3, 4, 5, 6, 7]`i = e[:]# `i` is a copy of `e`j = e[1:7:2]# `j` is `[1, 3, 5]`k = e[5:2:-1]# `k` is `[5, 4, 3]`l = e[5::-1]# `l` is `[5, 4, 3, 2, 1, 0]`m = e[::-1]# `m` is `[7, 6, 5, 4, 3, 2, 1, 0]`
Method __getslice__ should never be called directly, instead str_obj[slice] syntax should be used.
capitalize
() -> str
Returns the string with the first letter capitalized.
center
(length, character) -> str
Centers the string within the specified width using a fill character.
length
int
required
Length of the result string.
character
str
default:" "
Fill character.
count
(value, start, end) -> int
Returns the count of non-overlapping occurrences of a substring within [start, end].
value
str
required
Value to search for.
start
int
required
Start index to search.
end
int
required
End index to search.
endswith
(value, start, end) -> bool
Returns True if the string ends with the suffix, otherwise False.
value
str
required
Value to check if the end of the string equals.
start
int
required
Start index to check the end of the string.
end
int
required
End index to check the end of the string.
find
(value, start, end) -> int
Returns the lowest index where the substring is found.
value
str
required
Value to search for.
start
int
required
Start index for searching.
end
int
required
End index for searching.
Use the find() method to get the position of a substring. To check for its presence, use the in operator.
index
(value, start, end) -> int
Returns the lowest index of the substring within [start, end], raising an error if not found.
value
str
required
Value to search for.
start
int
required
Start index for searching.
end
int
required
End index for searching.
isalpha
() -> bool
Returns True if the string contains only alphabetic characters and is not empty; otherwise, False.
islower
() -> bool
Returns True if all cased characters are lowercase and there is at least one, otherwise False.
isspace
() -> bool
Returns True if the string contains only whitespace and is not empty, otherwise False.
isupper
() -> bool
Returns True if all cased characters are uppercase and there is at least one, otherwise False.
join
(l) -> str
Returns a string that joins the elements of the list, using the string as a separator.
l
list[str]
required
List of strings to join.
ljust
(length, character) -> str
Left justifies the string within the specified width, padding with the fill character. Returns the original string if width is less than or equal to its length.
length
int
required
Length of the result string.
character
str
default:" "
Fill character.
lower
() -> str
Returns a copy of the string with all cased characters in lowercase.
lstrip
(symbols) -> str
Returns a copy of the string with leading characters removed.
symbols
str
default:" "
Characters to remove.
partition
(s) -> list[str]
Splits the string at the first occurrence of sep and returns a list with the parts before, the separator, and after.
s
str
required
String separator value.
replace
(oldvalue, newvalue, count) -> str
Returns a copy of the string with all occurrences of old replaced by new, or the first count occurrences if specified.
oldvalue
str
required
Old value to search.
newvalue
str
required
New value to replace with.
count
int
default:-1
How many occurrences to replace.
rfind
(value, start, end) -> int
Returns the highest index of sub within [start, end], or -1 if not found.
value
str
required
Value to search for.
start
int
required
Start index for searching.
end
int
required
End index for searching.
rindex
(value, start, end) -> int
Returns the highest index of sub within [start, end], raising an error if not found.
value
str
required
Value to search for.
start
int
required
Start index for searching.
end
int
required
End index for searching.
rjust
(length, character) -> str
Right justifies the string within the specified width, padding with the fill character. Returns the original string if width is less than or equal to its length.
length
int
required
Length of the result string.
character
str
default:" "
Fill character.
rpartition
(s) -> list[str]
Splits the string at the last occurrence of sep and returns a list with the parts before, the separator, and after.
s
str
required
String separator value.
rsplit
(separator, maxsplit) -> list[str]
Splits the string into words using sep as the delimiter, with an optional maxsplit from the right.
separator
str
default:" "
String separator value.
maxsplit
int
default:-1
Number of splits.
rstrip
(symbols) -> str
Returns a copy of the string with trailing characters removed.
symbols
str
default:" "
Characters to remove.
split
(separator, maxsplit) -> list[str]
Splits the string into words using sep as the delimiter, with at most maxsplit splits, resulting in up to maxsplit+1 elements.
separator
str
default:" "
String separator value.
maxsplit
int
default:-1
Number of splits.
startswith
(value, start, end) -> bool
Returns True if string starts with the prefix, otherwise False.
value
str
required
Value to check if the beginning of the string equals.
start
int
required
Start index to check the beginning of the string.
end
int
required
End index to check the beginning of the string.
strip
(symbols) -> str
Returns a string with the leading and trailing characters removed.
symbols
str
default:" "
Characters to remove.
swapcase
() -> str
Returns a copy of the string with case swapped.
upper
() -> str
Returns a copy of the string with all cased characters in uppercase.
Example
# examples of slices extraction:a ='01234567'b = a[2:5]# `b` is '234'c = a[:5]# `c` is '01234'd = a[2:]# `d` is '234567'e = a[:]# `e` is a copy of `a`f = a[1:7:2]# `f` is '135'g = a[5:2:-1]# `g` is '543'h = a[5::-1]# `h` is '543210'i = a[::-1]# `i` is '76543210'