0

Is the rect() function a built-in function?

By this point I'm not sure if the rect() function is a built-in or custom function. :/

12th Jun 2024, 6:36 PM
Patryk Rekas
Patryk Rekas - avatar
4 odpowiedzi
12th Jun 2024, 7:00 PM
Keith
Keith - avatar
+ 3
Yes, The cmath.rect() function is a part of the cmath module, which is a built-in module in Python. Here you will find a list of other functions incase you are unsure about any others. https://www.w3schools.com/python/module_cmath.asp
13th Jun 2024, 4:14 AM
Chris Coder
Chris Coder - avatar
+ 2
# Hi, Patryk Rekas, # No, rect() is not a built-in function in Python. Built-in functions # in Python are those that are available directly without needing # any import. They follow the LEGB (Local, Enclosing, Global, Built-in) # rules for scope, where built-in functions represent the ‘B’ in LEGB. # You can print all built-in functions in Python using the following code: import builtins builtin_functions = [f for f in dir(builtins) if f[0].islower() and callable(getattr(builtins, f))] builtin_functions.sort() for i, func in enumerate(builtin_functions): print(f"{i + 1:3} {func}") # However, rect() can be found in several other modules related # to Python, such as the standard library module cmath, Pygame, or Matplotlib. # https://sololearn.com/compiler-playground/ccmf6wBjYv4x/?ref=app
12th Jun 2024, 11:37 PM
Per Bratthammar
Per Bratthammar - avatar
+ 1
Ok, thanks a lot
12th Jun 2024, 7:01 PM
Patryk Rekas
Patryk Rekas - avatar