Programming

Generate Secure Random Data in Python

Random generator provided by the Python random module is not cryptographically secure. So secrets module in Python is used to generate cryptographically strong random numbers suitable for managing data such as passwords, account authentication and security tokens. Random Element from Sequence Random numbers can be used to randomly choose an [...]

2020-09-09T19:43:00+05:30Categories: Programming|Tags: |

Generate Random Numbers in Python

Introduction A random sequence of events, symbols or steps often has no order and does not follow an intelligible pattern or combination. A random number generator is a system that generates random numbers from a true source of randomness. Pseudo random numbers is a sample of numbers that look close [...]

2020-09-09T17:14:56+05:30Categories: Programming|Tags: |

Reading and Writing CSV Files in Python

Introduction A CSV (Comma Separated Values) files is a type of plain text file that uses specific structuring to arrange tabular data. Generally comma is used to separate each specific data value. CSV format is the most common import and export format for spreadsheets and databases. csv module in Python [...]

2020-09-09T14:08:23+05:30Categories: Programming|Tags: |

Working with Temporary Files in Python

Introduction An application uses temporary files to store intermediate information on disk. These files are located in a separate directory, which varies on different operating systems, and the name of these files are unique. The tempfile module provides several functions for creating filesystem resources securely. TemporaryFile() opens and returns an [...]

2020-09-08T19:40:30+05:30Categories: Programming|Tags: |

Sorting Data in Python

Introduction Sorting is used to arrange the data in certain order. sorted() is built-in function in python that returns a sorted list of the iterable object i.e. list, dictionary, and tuple. Python lists have a built-in list.sort() method that modifies the list in-place. Syntax of sorted() function is sorted(iterable, key=None, [...]

2020-09-08T14:44:47+05:30Categories: Programming|Tags: |

Array Bisection in Python

Bisect algorithm maintains a list in sorted order without having to call sort each time an item is added to the list. bisect module in Python defines a number of functions to keep the array in a sorted fashion. The module uses bisection algorithm to do its work. It inserts [...]

2020-09-08T12:38:16+05:30Categories: Programming|Tags: |

Arrays of Numeric Value in Python

An array is a data structure which can hold more than one value. It is ordered series of elements of the same type. Arrays behave very much like lists, except that the type of objects stored in them is constrained. array module defines an object type which can compactly represent [...]

2020-09-07T18:36:11+05:30Categories: Programming|Tags: |

Smart Pointers in C++

Smart pointers in C++ are a wrapper class. It is used to manage dynamically allocated memory and to ensure that the memory gets deleted when the smart pointer object goes out of scope. Smart pointers are just classes that wrap the raw pointer and offer the same syntax (overloaded -> [...]

2020-09-03T19:02:46+05:30Categories: Programming|Tags: |

Difference between Pointer and Reference

A pointer in C++ is a variable that holds the memory address of another variable. A reference is an alias for an already existing variable. Once a reference is initialized to a variable, it cannot be changed to refer to another variable. Hence, a reference is similar to a const [...]

2020-09-03T15:25:29+05:30Categories: Programming|Tags: |

Get Current Thread ID Of Function In C++

std::this_thread::get_id is an in-built function in C++ std::thread. It is an observer function which means it observes a state and then returns the corresponding output. Below is the syntax std::thread::id get_id() noexcept; (since C++11) It returns object of member type thread::id which uniquely identifies the thread (if joinable), or default-constructed [...]

2020-07-19T23:00:40+05:30Categories: Programming|Tags: , |
Go to Top