Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
I Need Help with Python
#1
Does anyone here know python? I need help with it real fast. Please reply here or PM me thanks!
[Image: 29ol3br.png]
Reply
#2
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?
[Image: izsyo6.jpg]


Reply
#3
Just post the code in here so more people can take a look...
I probably can help you, same as uber1337.
Reply
#4
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.
[Image: 29ol3br.png]
Reply
#5
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!"
Reply
#6
There is no value if I type "no" instead of "yes"
[Image: 29ol3br.png]
Reply
#7
(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
[Image: izsyo6.jpg]


Reply
#8
(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!"
Reply
#9
(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.
[Image: izsyo6.jpg]


Reply
#10
I don't have interest in learning python, I just want to pass the class to get the credit.
[Image: 29ol3br.png]
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Python Help Dεlluzion 3 2,006 09-30-2019, 12:59 AM
Last Post: samsmith001
  Simple Python Python Compiler Canoris 21 9,191 06-01-2011, 06:30 PM
Last Post: Filefinder
  Python 2 vs 3? Jake 8 2,667 12-11-2010, 04:13 PM
Last Post: Bursihido
  Python help Kharnage 2 897 02-12-2010, 09:07 PM
Last Post: Kharnage
  "==" and "is" in Python Canoris 1 851 02-07-2010, 03:55 PM
Last Post: uber1337

Forum Jump:


Users browsing this thread: 1 Guest(s)