I have a plan to create a programming language
Hello, I am an admin of Rollpie. I am a huge fan of Python and has developed this website with Python. No doubt I love Python but I have a plan ...
What programming language do you prefer most? Please ignore the trend or salary averages of languages. Select your favorite language.
10votes
tips
Python None - The ids of all Nones are the same
In Python, None means null or nothing. The function that doesn't have the return statement returns None. Some Python programmers may substitu...
Get the name of my computer OS in Python
You can get the name of your computer OS in Python. python import sys p = sys.platform print(p) # darwin The platform name of ...
Python - The difference of mutable and immutable objects
In Python, all are objects. An integer, float, string, list, tuple are objects and a class and function are also objects. Python objects are imm...
Python copy and deepcopy - What is the difference of assignment, copy, and deepcopy?
The difference of dictionary assignment, copy, and deepcopy is found when updating the original dictionary. python import copy d = {'x':...
Python thousands separators - Don't use commas and use underscores
You can format an Python interger as a string with thousands separators using the `format()`. python s1 = '{:,}'.format(31415) s2 = '{:,}'...
Python __all__ and the scope over files - __all__ should be used when importing * in outer files
Many Python modules `__all__` to declare variables or functions that outer files can access. In short, the objects in `__all__` are "public" and...
Python try-except statement - what's the exception handling?
Python string can't be added to integer and in that case, Python "returns" error. python x = 'abc' y = x + 1 # TypeError: can only co...
Python assert statement: How to set the error message in the AssertionError
Python `assert` checks a condition and raises the AssertionError if it is false. No error happens in the following code. python assert True...
Python next - How to iterate and get the next item of a list
Python `next` returns the next item of an iterator. But what's an iterator? Python iterator is similar to list and can be iterated. python ...
Python import and from - How to use functions in outer files or directories in Python
Python `import` helps the files and directories to be connected or callable. `import` is used to import the functions or values in the outer fil...
Get all the functions of a Python module
You can get all the functions of a module using `inspect` module. python import statistics from inspect import getmembers, isfunction f...
Python help() - Print the documentation (docstring) of a Python function
The `help()` prints the Python function's documentation (or docstring), which is written between triple double quotes in the declaration. The do...
Count the digits of an integer in Python
Counting the digit of a integer looks easy but it's not actually easy. python a1 = 0 a2 = 3 a3 = 41 a4 = 123456789 d1 = len(str(a1)) ...
Python map - How to make a list from a list
Python map makes a list from a list. python def hello(name): return 'Hello, ' + name + '.' a = ['Alice', 'Bob'] b = map(hello,...
Python filter and lambda - How to select elements with a condition
Python built-in function `filter` removes some items from a list. The following code is to make a new list from an old list choosing multiples o...
Python comment: How to write comments in Python
In Python, a line starting with `#` is regarded as a comment. python a = 1 b = 2 print(a) # print(b) In the above code, `print(b...
Python String
Python List
Python Tuple
Python Set
Python Dictionary
Python Float
Python Decimal
Python Fraction
Python Date & Time
Python Function
Python Class
Python File
Python Built in
Python Math
Python Counter
Python Functools
Python Itertools
Python Deque
Python Tips
© Rollpie