Server Side Programming Articles

Page 600 of 2109

How to input multiple values from user in one line in Python?

AmitDiwan
AmitDiwan
Updated on 25-Mar-2026 6K+ Views

In Python, to get multiple values from users in a single line, there are several approaches. The most common methods use split() with map() or list comprehension to parse space-separated input. Using Multiple input() Calls The basic approach uses separate input() calls for each value − x, y, z = input(), input(), input() print(x) print(y) print(z) If the user enters 5, 10, 15 in separate prompts, the output will be − 5 10 15 This method requires multiple user inputs, which is not ideal for single-line input. Using map() ...

Read More

Mathematical Functions in Python?

George John
George John
Updated on 25-Mar-2026 3K+ Views

Python's math module provides essential mathematical functions for performing operations ranging from basic arithmetic to complex trigonometric and logarithmic calculations. All math functions work with integers and real numbers, but not with complex numbers. To use mathematical functions, you need to import the math module ? import math Mathematical Constants The math module provides several important mathematical constants ? Constant Description math.pi Returns the value of π: 3.141592 math.e Returns the value of natural base e: 2.718282 math.tau Returns the value of ...

Read More

How to write an empty function in Python?

AmitDiwan
AmitDiwan
Updated on 25-Mar-2026 3K+ Views

In this article, we will see how we can create empty functions in Python. A function is a block of organized, reusable code that is used to perform a single, related action. Functions provide better modularity for your application and a high degree of code reusing. Function blocks begin with the keyword def followed by the function name and parentheses (). Here, we will see examples of empty functions using the pass statement. What is the pass Statement? The pass statement is a null operation in Python. It does nothing when executed and serves as a placeholder ...

Read More

Reloading modules in Python?

AmitDiwan
AmitDiwan
Updated on 25-Mar-2026 20K+ Views

The reload() function is used to reload a previously imported module. This is particularly useful during interactive development sessions where you modify a module's code and want to see changes without restarting the Python interpreter. When you modify a module file after importing it, Python continues to use the cached version. The reload() function forces Python to re-read and re-execute the module code. How reload() Works When reload() is executed, several important things happen: The module's code is recompiled and re-executed, creating new objects bound to names in the module's dictionary Old objects are only ...

Read More

Inplace vs Standard Operators in Python

Chandu yadav
Chandu yadav
Updated on 25-Mar-2026 586 Views

Python provides two types of operators: inplace operators that modify variables directly, and standard operators that create new values. Understanding the difference helps you write more efficient code. Inplace Operators Inplace operators modify the original variable without creating a copy. They use compound assignment syntax like +=, -=, etc. Basic Example a = 9 a += 2 print(a) 11 The += operator adds 2 to the original value of a and updates it in place. Common Inplace Operators += (addition) -= (subtraction) *= (multiplication) /= (division) %= ...

Read More

Global and Local Variables in Python?

Arjun Thakur
Arjun Thakur
Updated on 25-Mar-2026 13K+ Views

In Python, variables have different scopes that determine where they can be accessed. There are two main types: global variables (accessible throughout the entire program) and local variables (accessible only within the function where they are defined). Local Variables Local variables are created inside a function and can only be accessed within that function. They exist only during the function's execution ? def my_function(): x = "Python" # Local variable print("Inside function:", x) my_function() # print(x) # This would cause NameError Inside ...

Read More

Time Functions in Python?

Chandu yadav
Chandu yadav
Updated on 25-Mar-2026 15K+ Views

Python provides a comprehensive library to read, represent and manipulate time information through the time module. Date, time and datetime are objects in Python, so whenever we perform operations on them, we work with objects rather than strings or timestamps. The time module follows the EPOCH convention, which refers to the starting point for time calculations. In Unix systems, EPOCH time started from January 1, 1970, 12:00 AM UTC. Understanding EPOCH Time To determine the EPOCH time value on your system ? import time print(time.gmtime(0)) time.struct_time(tm_year=1970, tm_mon=1, tm_mday=1, tm_hour=0, tm_min=0, tm_sec=0, tm_wday=3, ...

Read More

Transpose a matrix in Python?

Arjun Thakur
Arjun Thakur
Updated on 25-Mar-2026 4K+ Views

Transpose a matrix means we're turning its columns into its rows. Let's understand it by an example what it looks like after the transpose. Let's say you have original matrix something like − matrix = [[1, 2], [3, 4], [5, 6]] print(matrix) [[1, 2], [3, 4], [5, 6]] In above matrix we have two columns, containing 1, 3, 5 and 2, 4, 6. So when we transpose above matrix, the columns becomes the rows. So the transposed version would look something like − [[1, 3, 5], [2, 4, 6]] ...

Read More

ipaddress - IPv4/IPv6 manipulation library in Python

Vrundesha Joshi
Vrundesha Joshi
Updated on 25-Mar-2026 1K+ Views

Internet Protocol is currently in the process of moving from version 4 to version 6. This is necessitated because version 4 doesn't provide enough addresses to handle the increasing number of devices with direct connections to the internet. An IPv4 address is composed of 32 bits, represented into four eight-bit groups called "octets". This is a "dotted decimal" format where each eight-bit octet can have a decimal value 0 to 255. For example: 192.168.1.1 IPv4 address with CIDR notation: 192.168.1.1/24 where 24 means first three octets identify the network and last octet identifies node. An IPv6 ...

Read More

urllib.robotparser - Parser for robots.txt in Python

Nitya Raut
Nitya Raut
Updated on 25-Mar-2026 831 Views

Web site owners use the /robots.txt file to give instructions about their site to web robots; this is called The Robots Exclusion Protocol. This file is a simple text-based access control system for computer programs that automatically access web resources. Such programs are called spiders, crawlers, etc. The file specifies the user agent identifier followed by a list of URLs the agent may not access. Example robots.txt File #robots.txt Sitemap: https://example.com/sitemap.xml User-agent: * Disallow: /admin/ Disallow: /downloads/ Disallow: /media/ Disallow: /static/ This file is usually put in the top-level directory of your web server. ...

Read More
Showing 5991–6000 of 21,090 articles
« Prev 1 598 599 600 601 602 2109 Next »
Advertisements