Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
A weather program.
#1
This is something I have always been interested in doing. It's a work in progress but it's fully functional. Dance

#! /usr/bin/env python
# By Micah M. 2018
# weather version 1.2
# Python 3.7


def forcast():
    options = ('1 Rising', '2 Falling', '3 Steady')
    print('\n'.join(options))
    trend = input('\nChoose a trend for the barometric pressure.\n> ')
    if trend == '1':
        print('\nFairer weather on the way.\n')
    elif trend == '2':
        print('\nPoorer weather on the way.\n')
    elif trend == '3':
        print('\nNo significant change in the weather.\n')

def dewPoint():
    t = input('\nEnter the temperature in Celsius.\n> ')
    rh = input('\nEnter the relative humidity\n> ')
    formula = (int(t) - ((100 - int(rh)) / 5))
    print(f'\nThe dew point is {int(formula)} degrees Celsius.\n')
	

def celsius():
    convert = input('\nEnter the temperature in Celsius.\n> ')
    formula = int(convert) * 1.8 + 32
    print(f'{convert} degrees Celsius is {int(formula)} degrees Fahrenheit.\n')


def fahrenheit():
    convert = input('\nEnter the temperature in Fahrenheit.\n> ')
    formula = (int(convert) - 32) / 1.8
    print(f'{convert} degrees Fahrenheit is {int(formula)} degrees Celsius.\n')


def prompt():
    	while True:
            options = ('1 Convert from Fahrenheit', '2 Convert from Celsius',
                       '3 Find Dew Point', '4 Weather forcast', '5 Exit')
            print('\n'.join(options))
            unitChoice = input('\nWhat would you like to do?\n> ')
            if unitChoice == '1':
                fahrenheit()
            elif unitChoice == '2':
                celsius()
            elif unitChoice == '3':
                dewPoint()
            elif unitChoice == '4':
                forcast()
            elif unitChoice == '5':
                raise SystemExit
            else:
                print('\nInvalid Entry\n')

prompt()
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  PyQt6 Version of weather app menator01 3 3,195 Jan-30-2022, 12:32 AM
Last Post: menator01
  Tkinter Weather App menator01 1 1,970 Jan-16-2022, 11:23 PM
Last Post: menator01
  Meteostat - Historical Weather and Climate Data clampr 1 3,671 May-25-2021, 04:32 PM
Last Post: Gribouillis
  Talking Weather b4iknew 0 2,112 Jan-31-2019, 08:42 PM
Last Post: b4iknew
  SCIKItlearn -Naive Bayes Accuracy (Weather Data) usman 0 3,299 Nov-07-2018, 05:25 PM
Last Post: usman

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020