Support Forums
I Need Help with Python - Printable Version

+- Support Forums (https://www.supportforums.net)
+-- Forum: Categories (https://www.supportforums.net/forumdisplay.php?fid=87)
+--- Forum: Coding Support Forums (https://www.supportforums.net/forumdisplay.php?fid=18)
+---- Forum: Python Programming Language (https://www.supportforums.net/forumdisplay.php?fid=32)
+---- Thread: I Need Help with Python (/showthread.php?tid=4675)

Pages: 1 2


I Need Help with Python - Kharnage - 02-04-2010

Does anyone here know python? I need help with it real fast. Please reply here or PM me thanks!


RE: I Need Help with Python - uber1337 - 02-04-2010

Yes I know python somewhat. How advanced is the help you need? Either way I will give it a shot, what do you need help with?


RE: I Need Help with Python - Gaijin - 02-04-2010

Just post the code in here so more people can take a look...
I probably can help you, same as uber1337.


RE: I Need Help with Python - Kharnage - 02-04-2010

I need help making the following program

salted water does not freeze at 0 celcius, instead it requires a lower temp (pretend it's -10 celcius) ask if the water is salted or not, and ask for the temperature. print if the water will freeze or not.

I need it by tonight.

Please make it as simple as possible, thanks.


RE: I Need Help with Python - Gaijin - 02-04-2010

This is as simple as it can get...

Code:
#!usr/bin/env python

temp = raw_input("What's the Temperature? ")
water = raw_input("Is the Water salted? ")

if water == "yes" :
    if int(temp) <= -10:
        print "Water freezes"
    else:
        print "No, It's not cold enough!"



RE: I Need Help with Python - Kharnage - 02-04-2010

There is no value if I type "no" instead of "yes"


RE: I Need Help with Python - uber1337 - 02-04-2010

(02-04-2010, 06:35 PM)Kharnage Wrote: I need help making the following program

salted water does not freeze at 0 celcius, instead it requires a lower temp (pretend it's -10 celcius) ask if the water is salted or not, and ask for the temperature. print if the water will freeze or not.

I need it by tonight.

Please make it as simple as possible, thanks.

I trust that this is homework? I can make it but it would be better if I knew whether you just want your homework if you you are interested in the language. Anyway here it is:

Code:
x = raw_input('Is the water salted?')  
y = int(raw_input('What temperature is the water at?'))

if x=='yes' and y <= -10:
    print 'This water will freeze'
    raw_input()
elif x=='no' and y <= 0:
    print 'This water will freeze'
    raw_input()
else:
    print 'This water will not freeze'

This will declare variables that ask the user if it is salted or not and the temperature. If the water is salted and the temperature is less than or equal to -10, it will print 'This water will freeze'. If the water is not salted and the temperature is less than or equal to 0, it will print 'This water will freeze'. Any other input given it will print 'This water will not freeze'
Hope this helped! Blackhat


RE: I Need Help with Python - Gaijin - 02-04-2010

(02-04-2010, 06:53 PM)Kharnage Wrote: There is no value if I type "no" instead of "yes"


Well thought you can do it alone Tongue
edit: but go with uber1337's code, I think it's more what you're looking for
Code:
#!usr/bin/env python

temp = raw_input("What's the Temperature? ")
water = raw_input("Is the Water salted? ")

if water == "yes" :
    if int(temp) <= -10:
        print "Water freezes"
    else:
        print "No, It's not cold enough!"
elif water == "no":
    print "Do the magic here!"



RE: I Need Help with Python - uber1337 - 02-04-2010

(02-04-2010, 06:56 PM)Master of The Universe Wrote: Well thought you can do it alone Tongue
edit: but go with uber1337's code, I think it's more what you're looking for
Code:
#!usr/bin/env python

temp = raw_input("What's the Temperature? ")
water = raw_input("Is the Water salted? ")

if water == "yes" :
    if int(temp) <= -10:
        print "Water freezes"
    else:
        print "No, It's not cold enough!"
elif water == "no":
    print "Do the magic here!"
Lol I don't think he knows about Python, otherwise he would code such an easy program by himself, and I doubt he has any interest in learning it, due to his urgent need to get this program by tonight.


RE: I Need Help with Python - Kharnage - 02-04-2010

I don't have interest in learning python, I just want to pass the class to get the credit.