Skip to content
This repository was archived by the owner on Apr 24, 2025. It is now read-only.

Commit d0b8299

Browse files
committed
feat: add country to output.
1 parent 51050b2 commit d0b8299

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

projects/API Based Weather Report/API Based Weather Report.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def write_to_file(location, weather_data):
3333

3434
# Writing header information to the file
3535
f.write("-------------------------------------------------------------\n")
36-
f.write(f"Weather Stats for - {location.upper()} || {date_time}\n")
36+
f.write(f"Weather Stats for - {weather_data['name']} | {weather_data['sys']['country']} | {date_time}\n")
3737
f.write("-------------------------------------------------------------\n")
3838

3939
# Writing temperature information to the file
@@ -98,6 +98,8 @@ def main():
9898
write_to_file(location, weather_data)
9999

100100
# Printing weather information to console
101+
print("Current City : " + weather_data['name'] + ', ' +
102+
weather_data['sys']['country'])
101103
print(
102104
"Current temperature is: {:.2f} °C".format(
103105
weather_data["main"]["temp"] - 273.15

0 commit comments

Comments
 (0)