Project - Report - Shashwat (1) (1) (AutoRecovered)
Project - Report - Shashwat (1) (1) (AutoRecovered)
PROJECT REPORT ON
ROLL NO : 18
NAME : Rakshit Singh
CLASS : XII D
PROJECT GUIDE:
1
TABLE OF CONTENTS [ T O C ]
3
UNDERTAKING
01
4
CERTIFICATE
02
5
03 ACKNOWLEDGEMENT
6
04 INTRODUCTION
7
05 OBJECTIVES OF THE PROJECT
8-10
06 SOURCE CODE
11
07 OUTPUT
08 12
HARDWARE AND SOFTWARE REQUIREMENTS
09 13
BIBLIOGRAPHY
2
UNDERTAKING
the CBSE – AISSCE class XII certificate. I have not plagiarized or submitted the
same work for the award of any other examination. In case this undertaking
withdrawn.
3
CERTIFICATE
Weather Inquiry Bot in the subject Artificial Intelligence (417) laid down in
Class XII.
(Shivam Singh)
PGT CS/IP
Examiner:
Name:
Signature:
4
ACKNOWLEDGEMENT
Apart from the efforts of me, the success of any project depends
largely on the encouragement and guidelines of many others. I take this
opportunity to express my gratitude to the people who have been
instrumental in the successful completion of this project.
The guidance and support received from all the members who
contributed and who are contributing to this project, was vital for the
success of the project. I am grateful for their constant support and help.
5
PROJECT ON WEATHER INQUIRY BOT
INTRODUCTION
our activities, travel plans, and overall well-being. With the advent of
and up-to-date weather data. Users can inquire about the current weather
wind speed?" The bot processes user input, communicates with weather
user groups.
6
OBJECTIVES OF THE PROJECT
7
SOURCE CODE
import requests
def get_coordinates(location):
"""Fetch latitude and longitude for a location using Open Meteo API."""
url = f"https://geocoding-api.open-meteo.com/v1/search?name={location}"
response = requests.get(url)
if response.status_code == 200:
data = response.json()
if 'results' in data and len(data['results']) > 0:
latitude = data['results'][0]['latitude']
longitude = data['results'][0]['longitude']
return latitude, longitude
return None, None
def get_coldest_temperature():
"""Fetch the location with the coldest temperature currently."""
url = "https://api.open-meteo.com/v1/forecast?latitude=-
90&longitude=0¤t_weather=true"
response = requests.get(url)
if response.status_code == 200:
data = response.json()
if 'current_weather' in data:
weather = data['current_weather']
return weather['temperature'], "Antarctica"
return None, None
def get_hottest_temperature():
"""Fetch the location with the hottest temperature currently."""
url = "https://api.open-meteo.com/v1/forecast?
latitude=0&longitude=0¤t_weather=true"
response = requests.get(url)
if response.status_code == 200:
data = response.json()
if 'current_weather' in data:
weather = data['current_weather']
return weather['temperature'], "Equator"
return None, None
def get_highest_wind_speed():
"""Fetch the location with the highest wind speed currently."""
url = "https://api.open-meteo.com/v1/forecast?
latitude=45&longitude=0¤t_weather=true"
8
response = requests.get(url)
if response.status_code == 200:
data = response.json()
if 'current_weather' in data:
weather = data['current_weather']
return weather['windspeed'], "Mid-Latitudes"
return None, None
def air_bot():
print("Hi! I'm Air, your Weather Bot. I can tell you the current weather for any
location.")
print("You can also ask queries like 'Where is the coldest temperature right now?',
'Where is the hottest temperature?', or 'Where is the highest wind speed?' Type
'exit' to end the conversation.")
while True:
try:
query = input("Enter your query: ").strip()
except OSError:
print("Input is not supported in this environment. Exiting...")
break
if query.lower() == 'exit':
print("Goodbye! Stay safe and have a great day!")
break
if __name__ == "__main__":
air_bot()
10
OUTPUT
11
HARDWARE AND SOFTWARE REQUIREMENTS
CORE)
ATHALON
SOFTWARE REQUIREMENTS:
I. Windows OS
II. Python
12
BIBLIOGRAPHY
***
13