Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Python Weather

Name: Anonymous 2010-09-08 19:18

Weather prediction in Python 2.7

import random

filename = "weather.txt"
days = ["monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"]
weather = ["Cloudy", "Raining", "Clear", "Snowing"]

def pred(value):
    cl = "It's going to be either Cloudy or Clear tomorrow"
    cloudy = "It's going to be Cloudy tomorrow"
    clear = "It's going to be Clear tomorrow"
    if cur_day in text:
        if "clear" in text:
            print cloudy
        elif "raining" in text:
            print cl
        elif "snowing" in text:
            print cl
        elif "cloudy" in text:
            print clear
    else:
        print random.choice(weather)

while 1 > 0:
    cur_day = raw_input('Enter the current day: ')
    cur_weath = raw_input('Raining/Snowing/Clear/Cloudy ')
    day_weath = cur_day.lower() + " " + cur_weath.lower()
    if cur_day in days:
        break
    else:
        pass

old = open(filename, "r")
text = old.read() 
FILE = open(filename,"w")
FILE.writelines(day_weath)
FILE.close()

pred(0)

Name: Anonymous 2010-09-08 19:21

import random

filename = "weather.txt"
days = ["monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"]
weather = ["Cloudy", "Raining", "Clear", "Snowing"]

def pred(value):
    cl = "It's going to be either Cloudy or Clear tomorrow"
    cloudy = "It's going to be Cloudy tomorrow"
    clear = "It's going to be Clear tomorrow"
    if cur_day in text:
        if "clear" in text:
            print cloudy
        elif "raining" in text:
            print cl
        elif "snowing" in text:
            print cl
        elif "cloudy" in text:
            print clear
    else:
        print random.choice(weather)

while 1 > 0:
    cur_day = raw_input('Enter the current day: ')
    cur_weath = raw_input('Raining/Snowing/Clear/Cloudy ')
    day_weath = cur_day.lower() + " " + cur_weath.lower()
    if cur_day in days:
        break
    else:
        pass

old = open(filename, "r")
text = old.read()
FILE = open(filename,"w")
FILE.writelines(day_weath)
FILE.close()

pred(0)


FIXED IT FOR YA BRO

Name: Anonymous 2010-09-08 19:35

Weather prediction in R6RS Scheme

#!r6rs
(import (rnrs))
(display "Shit weather today and tomorrow.\n")

Name: Anonymous 2010-09-08 19:56

>>3
I guess every day would shitty when you use Scheme.

Name: Anonymous 2010-09-08 19:57

s/d /d seem /

Name: Anonymous 2010-09-08 22:40

>>3

>:(

Name: Anonymous 2010-09-08 23:37


#Weather prediction in Python 2.7

import random


If there was anything beyond that, I didn't read it.
But I chuckled inside a little.

Name: Anonymous 2010-09-08 23:52

    if cur_day in days:
        break
    else:
        pass

ITT useless

Name: Anonymous 2010-09-09 0:06

>>7
Care to explain why? Are you saying the universe is deterministic? No modern real world weather prediction systems use Monte Carlo or similar simulation algorithms?

Name: Anonymous 2010-09-09 3:41

>>9
Are you saying the universe is deterministic?
Weather is deterministic. That does not imply it's predictable. I'm so fucking sick of idiots like you not knowing the difference.

Name: Anonymous 2010-09-09 4:00

>>10
Deterministic on what? A non-deterministic environment? I'm sorry, you are full of shit.

Name: Anonymous 2010-09-09 5:08

>>8
the break is actually meaningful

Name: Anonymous 2010-09-09 11:01

>>12
No it isn't; you're already in a loop and that is the only condition for stopping the loop. Make it the loop's condition, not some retarded 1 > 0.

Name: Anonymous 2010-09-09 11:54

>>11
That doesn't make any sense.

Name: Anonymous 2010-09-09 14:18

Most of this code is entirely useless.

Name: Anonymous 2010-09-09 15:39

>>13
that's crazy talk

Name: Anonymous 2010-11-02 17:11

Name: Anonymous 2011-02-04 14:09


Don't change these.
Name: Email:
Entire Thread Thread List