It looks like you're using an Ad Blocker.

Thank you.

Some features of ATS will be disabled while you continue to use an ad-blocker.

# Any ATS python coders? Need help with my code. Thanks

page: 1
0
share:

posted on Oct, 11 2012 @ 10:28 AM
Trying to figure out how to get the maximum and minimum values of the random numbers that are displayed when the user inputs their numbers. I have everything done, I just can't figure out my last two. ** means where I'm having my problem. Where I'm stuck at. When the user chooses the four numbers the program should be able to try to find the lowest and highest values after the conversion. Been working on it all night and I'm pretty much stuck right here.

Thanks for the help.

def convertFahtoCel(x):
return( x - 32 ) * 5 / 9

def convertCeltoFah(x):
return( x + 32 ) * 9 / 5

def colorcode(x):
if x >= 110:
print("Red")
elif x >=90:
print("Orange")
elif x >= 32:
print("Yellow")
else:
print("Blue")
** def low(x):
fah1, fah2, fah3, fah4

** def high(x):
fah1, fah2, fah3, fah4

def main():
fah1, fah2, fah3, fah4 = input("Enter 4 tempertures in degrees Fahrenheit seperated by a comma: "))

#Start of Fahreheit to Celcius variable table

print("Farenheit ", end="t")
print("Celsius ", end="t")
print("Color Code")
print("_____________________________________________")
print(fah1, end="tt")
print(format(convertFahtoCel(fah1), "0.1f"), end="tt")
colorcode(fah1)

print(fah2, end="tt")
print(format(convertFahtoCel(fah2), "0.1f"), end="tt")
colorcode(fah2)

print(fah3, end="tt")
print(format(convertFahtoCel(fah3), "0.1f"), end="tt")
colorcode(fah3)

print(fah4, end="tt")
print(format(convertFahtoCel(fah4), "0.1f"), end="tt")
colorcode(fah4)
print("______________________________________________")

#End Table
#Start of second table
print()
print("Low/High ", end="t")
print(" Fahreheit ", end="t")
print(" Celsius ", end="t")
print("Color Code")
print("______________________________________________")
print("Low", end="t")
print(low, end="tt")
** print(format(convertFahtoCel(low), "0.1f"), end="tt")
** print(format(convertCeltoFah(low), "0.1f"), end="tt")
colorcode(low)

print("High", end="t")
print(high, end="tt")
** print(format(convertFahtoCel(high), "0.1f"), end="tt")
** print(format(convertCeltoFah(high), "0.1f"), end="tt")
colorcode(high)

main()

edit on 11-10-2012 by Manhater because: (no reason given)

edit on 11-10-2012 by Manhater because: (no reason given)

posted on Oct, 11 2012 @ 10:40 AM
Hello,

I am not well versed in python, but I will attempt at giving a solution.

First create a list of the entered arguments (i.e. fah1, fah2, fah3, fah4)

temps = [fah1,fah2,fah3,fah4]

effbot.org...
docs.python.org...

Then use these built in functions of python to capture the max and min of the list.

where x is the list created of the capture temperatures

def high(x)
return max(x)

def low(x)
return min(x)

docs.python.org...
docs.python.org...

Melek76

posted on Oct, 11 2012 @ 10:55 AM

If someone said, "John, I'll pay for \$10 Billion if you can explain this to me" I would be SOL.....

posted on Oct, 11 2012 @ 10:56 AM
PHP pushed out my python knowledge.

posted on Oct, 11 2012 @ 11:22 AM
I got the 100 but this is for 15 extra points. I know where to put it, just trying to figure out how to code it to the way I want it.
edit on 11-10-2012 by Manhater because: (no reason given)

posted on Oct, 12 2012 @ 08:41 PM
After painful staking hours at the problem, I finally got the code. Kid from my computer class helped me with it. I was on the right track just needed to get rid of x and add a few more code snippets to it. woot woot.

new topics

top topics

0