91.8k views
3 votes
Write a program in Python to calculate a year​

1 Answer

6 votes

Answer:

Sure, here is a Python program to calculate a year:

```python

# Import the datetime module

import datetime

# Get the current date and time

current_date = datetime.datetime.now()

# Get the year from the current date and time

year = current_date.year

# Print the year

print("The current year is", year)

```

Output:

```

The current year is 2023

```

Step-by-step explanation:

User Jedidja
by
8.2k points

No related questions found