Timeline for BMI calculator in python using if statements
Current License: CC BY-SA 4.0
16 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jan 2, 2019 at 8:45 | history | edited | SylvainD | CC BY-SA 4.0 |
added 202 characters in body
|
| Jan 1, 2019 at 11:33 | comment | added | SylvainD | @Solomon Ucko I'm not a native English speaker so your solution may be more idiomatic indeed. At first I didn't realize that "inch in meter" was ambiguous: converting an "inch in meter" gives 0.025 but the number of "inches in a meter" is 39.3. | |
| Jan 1, 2019 at 2:38 | comment | added | Solomon Ucko |
Shouldn't INCH_IN_M be named METERS_PER_INCH? INCH_PER_FOOT should also be named INCHES_PER_FOOT.
|
|
| Dec 31, 2018 at 21:26 | comment | added | Somtobechukwu Paul | Thanks Josay, some of the suggestions are a bit overwhelming, but i really appreciate it; It's been very helpful | |
| Dec 31, 2018 at 21:15 | vote | accept | Somtobechukwu Paul | ||
| Dec 31, 2018 at 10:32 | comment | added | SylvainD | @SolomonUcko That's a good point. I've integrated your comment in the answer. | |
| Dec 31, 2018 at 10:31 | history | edited | SylvainD | CC BY-SA 4.0 |
added 362 characters in body
|
| Dec 31, 2018 at 3:26 | comment | added | Solomon Ucko |
It's generally a good idea to have a main() function and have the last two (non-blank) lines be if __name__ == '__main__': main(). This allows the interactivity to be triggered as needed.
|
|
| Dec 30, 2018 at 20:53 | review | Suggested edits | |||
| Dec 30, 2018 at 21:08 | |||||
| Dec 30, 2018 at 18:00 | comment | added | SylvainD |
@Džuris Indeed, it would be the same. I kept the original elif because it didn't bother me. Then it is just a matter of personal preference. I have no strong opinion on this.
|
|
| Dec 30, 2018 at 17:43 | comment | added | Džuris |
sorry, I somehow misread a sample and was suggesting an idea similar to what's already there. Now that I read it properly on a computer, my question boils down to: Why do you need elif (instead of if) and else in the second sample? Isn't it that a later condition is only reached if none of the previous are met and just if (or nothing for the last case) would be enough?
|
|
| Dec 30, 2018 at 15:13 | comment | added | SylvainD | @Džuris I am not quite sure what you mean. Could you write somewhere ( pastebin.com ?) what you have in mind ? | |
| Dec 30, 2018 at 15:09 | comment | added | Džuris | I haven't written python for a few years, but couldn't you only use if and return with a response function as soon as a condition is met? | |
| Dec 30, 2018 at 15:02 | history | edited | Reinderien | CC BY-SA 4.0 |
Spelling and some formatting
|
| Dec 30, 2018 at 10:15 | history | edited | SylvainD | CC BY-SA 4.0 |
added 1618 characters in body
|
| Dec 30, 2018 at 10:01 | history | answered | SylvainD | CC BY-SA 4.0 |