NBC
NBC

Reputation: 27

A python program that tells the season of a given country (at the current time)

I have extremely basic knowledge of Python and I'm not asking for someone to make this for me. I just want a simple outline of steps that I would need to take to build this (assuming you were talking to someone that knew python).

Upvotes: 0

Views: 254

Answers (1)

Alex Metsai
Alex Metsai

Reputation: 1950

Step 1: Create a dict with countries and the location regarding the hemisphere, eg:

{"Netherlands": "North", "Brazil": "South", ...}

Step 2: get the current date:

import datetime
datetime.datetime.now()
# e.g. datetime.datetime(2021, 2, 19, 19, 32, 20, 796000)

Step 3:

If your hemisphere is North:
    if month is in [June, July, Aug]:
        it is summer
.....

elif your hemisphere is South:
    if month is in [June, July, Aug]:
        it is winter
....

You get the point.

Upvotes: 1

Related Questions