##### My first temperature converter
 My first temperature converter Posts: 6,935 Threads: 116 Joined: Sep 2016 Reputation: 538 Oct-18-2020, 04:39 PM (This post was last modified: Oct-18-2020, 04:39 PM by buran.) (Oct-18-2020, 03:26 PM)TheLowEndTheory Wrote: If I dont have the "return" and the cel, fah, kel, the program won't be able to return the calculation to convert the temperature type and the number that the user had input Note I refer only to `displayResults` function. ```def displayResults(cel, fah, kel): print("Celsius =", cel) print("Fahrenheit =", fah) print("Kelvin =", kel) return cel and fah and kel ```Your function just prints the arguments you pass. It does not need to return anything, nor you use what it currently returns. On line 65 you just call it `displayResults(cel, fah, kel)`. You don't assign what it returns to anything and simply throw it away. Now the other problem, look at the return statement: `return cel and fah and kel``cel`, `fah` and `kel` are floats. So if all 3 variables can be evaluated as True, it will return `kel`. If any of `cel` or `fah` is `0` or `0.0`, i.e. that is evaluated as True, it will return it. ```>>> 1 and 2 and 3 3 >>> 1 and 0.0 and 2 0.0 ```read more here https://docs.python.org/3.8/library/stdtypes.html#truth If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein How to Ask Questions The Smart Way: link and another link Create MCV example Debug small programs Reply

 Messages In This Thread My first temperature converter - by TheLowEndTheory - Oct-17-2020, 07:47 PM RE: My first temperature converter - by jefsummers - Oct-17-2020, 08:07 PM RE: My first temperature converter - by TheLowEndTheory - Oct-17-2020, 08:29 PM RE: My first temperature converter - by Yoriz - Oct-17-2020, 10:41 PM RE: My first temperature converter - by TheLowEndTheory - Oct-18-2020, 03:32 PM RE: My first temperature converter - by buran - Oct-18-2020, 06:53 AM RE: My first temperature converter - by TheLowEndTheory - Oct-18-2020, 03:26 PM RE: My first temperature converter - by buran - Oct-18-2020, 04:39 PM

 Possibly Related Threads… Thread Author Replies Views Last Post Temperature converter Help (ASAP) Edison_Weng 1 1,337 Apr-16-2018, 01:55 PM Last Post: stranac how to get the highest monthly average temperature? nikhilkumar 2 3,217 Jul-25-2017, 02:33 PM Last Post: DeaD_EyE Using a range and for loop - temp converter rattlerskin 5 7,089 Jan-20-2017, 09:15 PM Last Post: sparkz_alot Temp Converter with Kelvin vader33 7 6,503 Oct-02-2016, 05:16 AM Last Post: vader33

Forum Jump:

### User Panel Messages

##### Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020