ParameterDescription expression A String, that will be evaluated as Python code globals Optional. A dictionary containing global parameters locals Optional. A dictionary containing local parameters❮ Built-in Functions Track your progress - it's free! Log in Sign Up ...
Pythontype()Function ❮ Built-in Functions ExampleGet your own Python Server Return the type of these objects: a = ('apple','banana','cherry') b ="Hello World" c =33 x =type(a) y =type(b) z =type(c) Try it Yourself » ...
Pythonfilter()Function ❮ Built-in Functions ExampleGet your own Python Server Filter the array, and return a new array with only the values equal to or above 18: ages = [5,12,17,18,24,32] defmyFunc(x): ifx <18: returnFalse ...
Pythonbytes()Function ❮ Built-in Functions ExampleGet your own Python Server Return an array of 4 bytes: x = bytes(4) Try it Yourself » Definition and Usage Thebytes()function returns a bytes object. It can convert objects into bytes objects, or create empty bytes object of the speci...
Pythonint()Function ❮ Built-in Functions ExampleGet your own Python Server Convert the number 3.5 into an integer: x =int(3.5) Try it Yourself » Definition and Usage Theint()function converts the specified value into an integer number. ...
Pythonhasattr()Function ❮ Built-in Functions ExampleGet your own Python Server Check if the "Person" object has the "age" property: classPerson: name ="John" age =36 country ="Norway" x =hasattr(Person,'age') Try it Yourself » ...
Pythonrange()Function ❮ Built-in Functions Example Create a sequence of numbers from 0 to 5, and print each item in the sequence: x =range(6) forninx: print(n) Try it Yourself » Definition and Usage Therange()function returns a sequence of numbers, starting from 0 by default, and...
ExampleGet your own Python Server Create a class named Person, use the __init__() function to assign values for name and age: classPerson: def__init__(self, name, age): self.name = name self.age = age p1 = Person("John",36) ...
Pythonisinstance()Function ❮ Built-in Functions ExampleGet your own Python Server Check if the number 5 is an integer: x =isinstance(5,int) Try it Yourself » Definition and Usage Theisinstance()function returnsTrueif the specified object is of the specified type, otherwiseFalse. ...
Well organized and easy to understand Web building tutorials with lots of examples of how to use HTML, CSS, JavaScript, SQL, Python, PHP, Bootstrap, Java, XML and more.