Found 27154 Articles for Server Side Programming

Python Program to check date in date range

Niharika Aitam
Updated on 19-Oct-2023 14:43:57

1K+ Views

In this article we will learn how to check if the given input date falls in the specified date range or not. There are ways to do so; some of them are explained in detail. Using the datetime module Datetime module offers classes to manipulate the dates and times. This module provides various functions and methods such as date, time, datetime, timedelta, minyear, maxyear, UTC etc. Here in this article we will use the datetime() function of the datetime module. The datetime() accepts the date, month and year as the input arguments and returns the date as output. ... Read More

Python program to Check all strings are mutually disjoint

Niharika Aitam
Updated on 19-Oct-2023 14:41:20

54 Views

String is one of the data structures which hold the data enclosed in double quotes or in single quotes i.e. any data type enclosed inside the quotes considered as string. It is immutable, once we define the data we cannot change or modify. In python we have a function called str() which takes any data as the input and returns the string as output. Mutually disjoint means if no two strings are having the same elements in common. There are different ways to check if all strings are mutually disjoint. Let’s go through each one. Using nested loops Nested loop ... Read More

Python program to change the value of a dictionary if it equals K

Niharika Aitam
Updated on 19-Oct-2023 14:38:42

38 Views

Dictionary is one of the data structure available in python to store any datatype of data in the format of key and value pair. It is denoted by {} curly braces. The key in the dictionary is unique and the values in the dictionary can be repeated. The key and values pairs are separated by using the semi colon ‘:’. It is mutable i.e. once the dictionary created, we can modify the data. Dictionaries are versatile and widely used in Python for mapping and storing data where quick access to values based on keys is required. The dictionary is unordered ... Read More

Python program to calculate gross pay

Niharika Aitam
Updated on 19-Oct-2023 14:36:00

167 Views

Basically Gross pay is the total amount paid to an employee for the total time he/she worked, i.e. this is the full amount of salary of an employee before the taxes and deductions. The Gross pay also includes the bonuses, overtime or reimbursements from an employer on top of the salary pay. Mathematically the formula for the gross pay is as follows. Hours worked * pay per hour = gross pay per period For example, if an employee worked for 200 hours in a given period and earned Rs.300/- for an hour then the gross pay will be ... Read More

Python program to calculate square of a given number

Niharika Aitam
Updated on 19-Oct-2023 14:27:05

343 Views

Square is the defined as the multiplication of the number by itself. The square of a number n is given as n2. Mathematically we can implement square of the number as follows. $\mathrm{n^{2}=n*n}$ In the same way we can calculate the square of a given number by using python language too. There are few approaches in python to find the square of a number, let’s see them one by one. Using exponential operator (**) The exponential operator is the operator which is used to perform the exponent arithmetic operation. It is denoted with the symbol **. Syntax The ... Read More

Python program to calculate Date, Month and Year from Seconds

Niharika Aitam
Updated on 19-Oct-2023 14:23:07

238 Views

Generally, time is given in hours or minutes or seconds and from the given seconds, we can calculate the number of days, months and years. There are different modules and functions available in python such as datetime, time and divmod() which helps us to calculate the date month and year from seconds. Using Datatime module Datetime module offers classes to manipulate the dates and times. This module provides various functions and methods such as date, time, datetime, timedelta, minyear, maxyear, UTC etc. In the datetime method of datetime module we have the function utcfromtimestamp() which takes the seconds as ... Read More

Python program to calculate age in year

Niharika Aitam
Updated on 19-Oct-2023 14:20:56

5K+ Views

Generally, the age of a person is calculated by subtracting the birth year with the current year then the age of the person will be generated in years. In the same way we can calculate the age of a person by using the python modules datetime, dateutil and timedelta. General Calculation of Age in years Current year - Birth year Example In this example we are implementing the general way of calculating the age using pythn language by passing the current year and birth years as the inputs to created function age_calculator() then the total age will be generated ... Read More

Python program to calculate acceleration, final velocity, initial velocity and time

Niharika Aitam
Updated on 19-Oct-2023 14:17:19

598 Views

Acceleration, final velocity, initial velocity and time are the terms related to physical science which are widely used to study the motion and mechanics. Let’s see each one in detail. Acceleration Acceleration is the rate at which an object changes its velocity over the given time. It is denoted by a. Mathematically it is defined as the change in velocity divided by the change in time, the following is the formula. The unit of acceleration is meters per second $\mathrm{(m/s^2)}$ $\mathrm{a \:=\:(\Delta;\:vf − \Delta;vi)/\Delta;t}$ Where, $\mathrm{\Delta\:vi}$ is the Initial velocity $\mathrm{\Delta\:vf}$ is the Final velocity $\mathrm{\Delta\:t}$ is the ... Read More

Profiling in Python

Niharika Aitam
Updated on 19-Oct-2023 14:14:53

61 Views

In Python profiling is the measure of performance of different parts of a program to check and identify the areas of optimization and bottlenecks. We have many tools to perform profiling for the python code which includes built in modules, libraries and IDEs (Integrated development environments). There are different types of profiling of the python code, let’s see them one by one. Using Line profiling Line profiling is the technique used to measure the execution time of each individual line of the program. It helps us to identify which line is taking more execution time and to identify the tight ... Read More

Profile Application using Python Flask and MySQL

Niharika Aitam
Updated on 19-Oct-2023 14:12:47

131 Views

Flask is one of the web frameworks which provide libraries to build light weight web applications in python. It is a micro framework, developed by Armin Ronacher who runs an international group of python enthusiasts (POCCO). Flask works on WSGI toolkit and jinja2 template engines. For creating the profile application using python flask and MySQL we have to follow the below mentioned steps one by one. Step − 1 Install the virtual environment by executing the below mentioned command in the command prompt. pip install virtualenv Once the virtual environment is created we can create the new virtual environment into ... Read More

Advertisements