
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 10476 Articles for Python

890 Views
In this tutorial, we are going to learn about Unit Testing using the unittest built-in module. Testing plays a major role in software development. You will know the issues before going to the production itself.We'll learn the basics of testing in Python using the built-in module called unittest. Let's jump into the tutorial.What is Unit Testing?If you take the login system as an example. Each field in the login form is a unit/component. And testing those units/components functionality is known as Unit Testing.ExampleLet's see the basic structure of unittest framework. Live Demo# importing unittest module import unittest # unittest will test ... Read More

1K+ Views
This article is intended to demonstrate, how to bypass the anti-virus detection using the Veil framework, as it is a collection of tools designed for use during penetration testing. It currently consists of the following modules −Veil-Evasion − a tool to generate antivirus-evading payloads using a variety of techniques and languagesVeil-Catapult − a psexec-style payload delivery system that integrates Veil-EvasionVeil-PowerView − a powershell tool to gain network situational awareness on Windows domainsVeil-Pillage − a modular post-exploitation framework that integrates Veil-EvasionRequirementsTo install the Veil- Framework, you are supposed to configure the latest Python packages into your machine.How to InstallThe important point ... Read More

1K+ Views
PythonPython is a programing language designed to be simple to implement and easy to understand. It is a dynamically typed language. It is not using pointers.BashBash is a command-line interpreter and is shipped by default in Linux and MacOS operating systems. It can be installed in other operating systems as well. It is default User Shell for Linux and MacOS.The following are some of the important differences between Python and Bash.Sr. No.KeyPythonBash1TypePython is a programming language mostly used in automation programming.Bash is a command-line interpreter or user shell to interpret user commands.2BasisPython is developed as an easy to implement an ... Read More

307 Views
== operator== operator compares the operands by checking the equality of values of objects.is operatoris operator compares the operands by checking the objects to be the same or not.ExampleFollowing is the program in Python to showcase the difference. Live Demolist1 = [1] list2 = [1] list3 = list1 print(id(list1)) print(id(list2)) if (list1 == list2): print("True") else: print("False") if (list1 is list2): print("True") else: print("False") if (list1 is list3): print("True") else: print("False")Output140380664377096 140380664376904 True False True

7K+ Views
In PHP, the 'exec()' or 'shell_exec’ function can be used. It can be executed via the shell and the result can be returned as a string. It returns an error if NULL is passed from the command line or returns no output at all. 'exec()' Function The exec function is used for executing commands in the shell and command line of an external program and optinally capture the last line of the output. Syntax exec(string $command, array &$output = null, int &$return_var = null); 'shell_exec()' Function The shell_exec is similiar to exec but it captures and return the ... Read More

2K+ Views
Suppose we have a string; we have to check whether the given input is a valid IPv4 address or IPv6 address or neither.The IPv4 addresses are canonically represented in dotted-decimal notation, which consists of four decimal numbers, each ranging from 0 to 255, separated by dots ("."), For example, 192.168.254.1; Besides, leading zeros in the IPv4 address is invalid. For example, the address 192.168.254.01 is invalid.The IPv6 addresses are represented as eight groups of four hexadecimal digits, each group representing 16 bits. The groups are separated by colons (":"). For example, suppose the address is 2001:0db8:85a3:0000:0000:8a2e:0370:7334 is a valid address. ... Read More

4K+ Views
Suppose we have a string s. We have to find all the words vertically in the same order in which they appear in s. Here words are returned as a list of strings, we have to complete with spaces when is necessary. (Trailing spaces are not allowed). Each word would be put on only one column and that in one column there will be only one word. So if the input string is “HOW ARE YOU”, then the output will be [“HAY”, “ORO”, “WEU”]To solve this, we will follow these steps −s := make a list of strings split by ... Read More

183 Views
Suppose we have a string s, we have to make queries on substrings of s. For each query queries[i], there are three parts [left, right, k], we may rearrange the substring s[left], ..., s[right], and then choose up to k of them to replace with any lowercase English letter. If the substring is possible to be a palindrome after the operations mentioned above, the result of the query is true. Otherwise false. We have to find an array answer[], where answer[i] is the result of the i-th query queries[i].For example, if the input is “abcda”, queries is like [[3, 3, ... Read More

2K+ Views
Suppose we have to design a file system which provides these two functions −createPath(path, value) − This creates a new path and associates a value to it if possible and returns True. It returns False if the path already exists or its parent path doesn't exist.get(path) − This finds the value associated with a path or returns -1 if the path doesn't exist.The format of a path is one or more concatenated strings of the form − (forward slash) / followed by one or more lowercase English letters. For example, /programming and /programming/problems are valid paths while an empty string ... Read More

857 Views
Suppose we have d dice, and each die has f number of faces numbered 1, 2, ..., f. We have to find the number of possible ways (out of fd total ways) modulo 10^9 + 7 to roll the dice so the sum of the face up numbers equal to the target. So if the input is like d = 2, f = 6, target = 7, then the output will be 6. So if we throw each dice with 6 faces, then there are 6 ways to get sum 6, as 1 + 6, 2 + 5, 3 + ... Read More