Hi this is a question for my computer science course and I t

Hi, this is a question for my computer science course and I thought I had it figured out, but I\'m not getting anywhere. The programming language is Python. I still have to add another string at the end, but when I put the command in the shell it doesn\'t return anything. I\'m using Wing IDE 101 if that helps.

This is what I have, if it helps:

3. Write a function that takes as an argument, a temperature, in degrees Celsius. The function checks that the temperature is an integer between -273.15 and 1000 (inclusive) the temperature used is outside of these bounds, the function should return the string \"Temperature out of range.\" otherwise, the function returns uses the function in #1 to convert the temperature from degrees Celsius to degrees Fahrenheit and returns a string with the format \"Notice: xxx degrees Celsius is equivalent to YYY degrees Fahrenheit. Name your function celsiusToFahrenheitWords(temperature) For example, celsius ToFahrenheitWords(0) should return the string \"Notice: 0 degrees Celsius is equivalent to 32 degrees Fahrenheit.\" Spelling and punctuation are important! As another example, celsius To Fahrenheit Words 100.0 should return the string \"Notice: 100.0 degrees Celsius is equivalent to 212 degrees Fahrenheit.\" Pay attention to the numerical values included in the strings.

Solution

def celsiusToFahrenheitWords(temparature):
if temparature < -273.15 or temparature > 1000:
return \"Temparature is out of range\"
else:
fahrenheit = (temparature * 9)/float(5) + 32
return \"Notice: \"+str(temparature)+\" degrees celcisus is equivalent to degrees fahrenheit\"+str(fahrenheit)
  
celsisus = float(input(\"Enter the temparature in degree celsisus: \"))
print(celsiusToFahrenheitWords(celsisus))
  

Output:

sh-4.3$ python main.py                                                                                                                                                                                                                                 

sh-4.3$ python main.py                                                                                                                                                                                                                                 

Enter the temparature in degree celsisus: -50                                                                                                                                                                                                          

Notice: -50.0 degrees celcisus is equivalent to degrees fahrenheit-58.0                                                                                                                                                                                

sh-4.3$ python main.py                                                                                                                                                                                                                                 

Enter the temparature in degree celsisus: 900                                                                                                                                                                                                          

Notice: 900.0 degrees celcisus is equivalent to degrees fahrenheit1652.0                                                                                                                                                                               

sh-4.3$ python main.py                                                                                                                                                                                                                                 

Enter the temparature in degree celsisus: 1100                                                                                                                                                                                                         

Temparature is out of range   

Hi, this is a question for my computer science course and I thought I had it figured out, but I\'m not getting anywhere. The programming language is Python. I s

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site