codesimple - Code more. Learn more.
563 FOLLOWERS
A blog about web development, backend development, python and other tips and tricks. codesimple helps you learn better and code better. Happy coding!
codesimple - Code more. Learn more.
4y ago
Python is an amazing programming language, but it has two huge handicaps compared to compiled languages.The first one is GIL or Global Interpreter Lock. GIL is an actual process lock that forces a Python interpreter to work on a single process and use only one of the cores in your CPU. Due to this lock, Python is both simple and stable but also is very slow compared to other programming ..read more
codesimple - Code more. Learn more.
4y ago
Growing an audience is an expensive and painful task. And if you’d like to build an audience that’s relevant to you, and shares common interests, that’s even more difficult. I always saw Instagram has a great way to promote my photos, but I never had more than 380 followers... Every once in a while, I decide to start posting my photos on Instagram again, and I manage to keep posting regularly for ..read more
codesimple - Code more. Learn more.
4y ago
Map function is a good alternative for the “for loops” in python. Sometimes we do not want our code to look clumsy because of all the for loops we have used. In this case the “map()” in python comes to the rescue.
What are map functions?
map() function returns a map object(which is an iterator) of the results after applying the given function to each item of a given iterable (list ..read more
codesimple - Code more. Learn more.
4y ago
This is a simple python program to calculate the number of days a person has lived on earth.This program uses the datetime module in python.
Datetime in python
A date in Python is not a data type of its own, but we can import a module named datetime to work with dates as date objects.
Creating Date Objects
To create a date, we can use the datetime() class (constructor) of the datetime module ..read more
codesimple - Code more. Learn more.
4y ago
Lists
Unlike C++ or Java, Python Programming Language doesn’t have arrays. To hold a sequence of values, then, it provides the ‘list’ class. A Python list can be seen as a collection of values.
To create a python list of items, you need to mention the items, separated by commas, in square brackets. This is the python syntax you need to follow. Then assign it to a variable. Remember once again ..read more
codesimple - Code more. Learn more.
4y ago
This post will have 5 simple python programs. They are
print using python
check palindrome
Armstrong number
Find the greater number
print prime numbers in a range
All these programs are provided along with a code snippet in this part. More programs on the next part.
1. Print using python
This simple code snippet shows how to print using python.The simplest way to produce output is using the ..read more
codesimple - Code more. Learn more.
4y ago
In Python — along with most other languages — we use try statements to safeguard our code.
Let’s learn about what try statements do and how to begin using them!
What are Exceptions?
Before we dive into the syntax and implementation of try statements, it’s important to establish what exceptions are. An exception is the result of code within a try statement that fails. Think of an ..read more
codesimple - Code more. Learn more.
4y ago
An idempotent function always returns the same value given the same set of arguments, regardless of how many times it is called. The result does not depend on non-local variables, the mutability of arguments, or data from any I/O streams.
The following add_three(number) function is idempotent:
No matter how many times one calls add_three(7), the answer will always be 10. Here's a ..read more