Python Articles

Page 667 of 855

Calculating Wind Chill Factor(WCF) or Wind Chill Index(WCI) in Python Program

Hafeezul Kareem
Hafeezul Kareem
Updated on 25-Mar-2026 591 Views

In this tutorial, we will learn how to calculate the Wind Chill Factor (WCF) or Wind Chill Index (WCI) in Python. The wind chill index measures how cold it feels when wind is factored in with the actual air temperature. Wind Chill Formula We use the following standard formula to calculate the Wind Chill Index ? Twc = 13.12 + 0.6215Ta − 11.37v0.16 + 0.3965Tav0.16 Where: Twc = Wind Chill Index (in degrees Celsius) Ta = Air Temperature (in degrees Celsius) v = Wind Speed (in kilometers per hour) Implementation Steps Follow ...

Read More

Lambda expression in Python Program to rearrange positive and negative numbers

Hafeezul Kareem
Hafeezul Kareem
Updated on 25-Mar-2026 870 Views

In this tutorial, we will write an anonymous function using lambda to rearrange positive and negative numbers in a list. The goal is to place all negative numbers first, followed by all positive numbers. Algorithm Let's see how to solve the problem step by step ? 1. Initialize a list with negative and positive numbers. 2. Write a lambda expression that takes a list as an argument. 2.1. Iterate over the list and get negative numbers 2.2. Same for positive numbers 2.3. Combine both using concatenation operator. ...

Read More

Python Dictionary Comprehension

Hafeezul Kareem
Hafeezul Kareem
Updated on 25-Mar-2026 512 Views

In this tutorial, we are going to learn how to use dictionary comprehensions in Python. If you are already familiar with list comprehension, then it won't take much time to learn dictionary comprehensions. Dictionary comprehension provides a concise way to create dictionaries using a single line of code. We need key-value pairs to create a dictionary. The general syntax of dictionary comprehension is: {key: value for item in iterable} Basic Dictionary Comprehension Let's see how to generate numbers as keys and their squares as values within the range of 10. Our result should look ...

Read More

Program to print its script name as output in Python

Hafeezul Kareem
Hafeezul Kareem
Updated on 25-Mar-2026 1K+ Views

In this tutorial, we are going to write a program that prints the name of the Python script file. We can find the script name using the sys module. The sys module stores all the command line arguments of the python command in the sys.argv list. The first element in the list is the script name. We can extract it from that list. Python makes it easy. Getting Script Name Only To print just the script filename without the full path ? import sys import os # Get just the filename script_name = os.path.basename(sys.argv[0]) ...

Read More

Difference between Python and Ruby

Kiran Kumar Panigrahi
Kiran Kumar Panigrahi
Updated on 25-Mar-2026 498 Views

Python and Ruby are both popular high-level programming languages with distinct characteristics and use cases. Python, created by Guido van Rossum in 1989, emphasizes simplicity and readability. Ruby, developed by Yukihiro Matsumoto in 1995, follows the principle of programmer happiness with flexible syntax. What is Python? Python is an object-oriented, dynamic, interpreted language known for its clean syntax and powerful capabilities. High-level data structures, dynamic typing, and binding make it an excellent choice for rapid application development and scripting. Python's straightforward syntax reduces program maintenance costs. Its modular approach through packages and modules promotes code reusability. The ...

Read More

Bypass Anti-virus using Veil Framework

Ajay yadav
Ajay yadav
Updated on 25-Mar-2026 2K+ Views

This article demonstrates how to bypass antivirus detection using the Veil Framework, a collection of penetration testing tools. The framework consists of several modules designed for payload generation and evasion techniques. Veil Framework Components The Veil Framework includes the following key modules − Veil-Evasion − generates antivirus-evading payloads using various techniques and programming languages Veil-Catapult − a psexec-style payload delivery system that integrates with Veil-Evasion Veil-PowerView − a PowerShell tool for network reconnaissance on Windows domains Veil-Pillage − a modular post-exploitation framework integrated with ...

Read More

Validate IP Address in Python

Arnab Chakraborty
Arnab Chakraborty
Updated on 25-Mar-2026 2K+ Views

IP address validation is a common programming task. We need to determine whether a given string is a valid IPv4 address, IPv6 address, or neither. Each format has specific rules that must be followed. IPv4 Address Rules IPv4 addresses consist of four decimal numbers (0-255) separated by dots. Leading zeros are not allowed except for "0" itself ? Valid: 192.168.1.1, 0.0.0.0 Invalid: 192.168.01.1 (leading zero), 256.1.1.1 (out of range) IPv6 Address Rules IPv6 addresses consist of eight groups of hexadecimal digits (1-4 digits each) separated by colons. Leading zeros within groups can be ...

Read More

Print Words Vertically in Python

Arnab Chakraborty
Arnab Chakraborty
Updated on 25-Mar-2026 5K+ Views

Printing words vertically means taking each character at the same position from different words and forming new strings. For example, if we have "HOW ARE YOU", we take the first character from each word (H, A, Y) to form "HAY", second characters (O, R, O) to form "ORO", and so on. Algorithm Steps To solve this problem, we follow these steps − Split the input string into words Find the maximum length among all words (this determines how many vertical strings we need) For each position, collect characters from all words at that position Add spaces ...

Read More

Can Make Palindrome from Substring in Python

Arnab Chakraborty
Arnab Chakraborty
Updated on 25-Mar-2026 237 Views

Given a string s, we need to determine if substrings can be made into palindromes after performing certain operations. For each query [left, right, k], we can rearrange the substring s[left:right+1] and replace up to k characters. The goal is to check if a palindrome is possible after these operations. The key insight is that in a palindrome, at most one character can have an odd frequency (the middle character). So we need to count characters with odd frequencies and see if we can fix them with our allowed replacements. Algorithm We'll use a prefix sum approach ...

Read More

Design File System in Python

Arnab Chakraborty
Arnab Chakraborty
Updated on 25-Mar-2026 2K+ Views

A file system data structure allows us to create paths and associate values with them. We need to implement two main operations: creating a path with a value and retrieving the value associated with a path. Problem Requirements We need to design a file system that provides these two functions: createPath(path, value) − Creates a new path and associates a value to it if possible and returns True. Returns False if the path already exists or its parent path doesn't exist. get(path) − Finds the value associated with ...

Read More
Showing 6661–6670 of 8,549 articles
« Prev 1 665 666 667 668 669 855 Next »
Advertisements