0 votes
I want to find the number of days between any given two dates. How can I do this in Python?
May 30, 2018 in Python 455 views

## 1 answer to this question.

0 votes

You can use the date module to do this -

```from datetime import date

d1 = date(2012, 5, 22)
d2 = date(2018, 5, 26)
delta = d2 - d1
print(delta.days)```
answered May 30, 2018 by
• 4,260 points

0 votes
0 answers

## Write a Python program that takes as input a month and year, determines how many days are in the month, and outputs the number of days. Thirty days are in September, April, June, and November

Write a Python program that takes as ...READ MORE

0 votes
2 answers

## How to calculate square root of a number in python?

calculate square root in python >>> import math ...READ MORE

+5 votes
1 answer

## Print the odd and even factors of a number in Python

x = int(input("Enter any number \n")) print("The factors ...READ MORE

–1 vote
2 answers

## How to filter out any digit that contains odd number in a range of number in Python?

n = list(range(10)) b = list(filter(lambda i:i%2!=0,n)) print(b) READ MORE

0 votes
2 answers

## how can i randomly select items from a list?

You can also use the random library's ...READ MORE

+1 vote
2 answers

## how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

0 votes
1 answer

## how do i use the enumerate function inside a list?

Enumerate() method adds a counter to an ...READ MORE

+5 votes
6 answers

## Lowercase in Python

You can simply the built-in function in ...READ MORE

+1 vote
8 answers

## Count the frequency of an item in a python list

To count the number of appearances: from collections ...READ MORE

0 votes
1 answer

## Number division in python

For Python 3, use the // operator: q = ...READ MORE