Python Forum
Table of Temperatures... Help
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Table of Temperatures... Help
#4
more or less, yes.
However,
1. input will return string (str type), and to do calculations  you need integer (int type). So you need to convert the user input from str to int before use in calculations. As you don't need to keep the str, you can do this once, immediately (or even on the same line) with the input.
For your benefit, take time to research how you can do 1, before you ask here on the forum :-) I'm certain your teacher/lector has taught you that already.
2.As it is now, it will be accessible within the main(), i.e. you can use it. However you will run into problems if you try to change it in the main and is a bad programming because you run the risk to get confused with the scope of the name - if you have variable with the same name in the function. That may sound not relevant to your current task, but if it turns to bad habit or misunderstanding of concept - it will byte you in the future.
so, why not take the user input, as well initialize the other names (start, increment) within the main(), instead on module level?.
3. finally, I would take the definition of fahrenheit function out of the main()
Reply


Messages In This Thread
Table of Temperatures... Help - by zepel - May-07-2017, 06:29 AM
RE: Table of Temperatures... Help - by buran - May-07-2017, 06:33 AM
RE: Table of Temperatures... Help - by zepel - May-07-2017, 06:39 AM
RE: Table of Temperatures... Help - by buran - May-07-2017, 07:01 AM
RE: Table of Temperatures... Help - by zepel - May-07-2017, 07:28 AM
RE: Table of Temperatures... Help - by buran - May-07-2017, 07:39 AM
RE: Table of Temperatures... Help - by buran - May-07-2017, 07:41 AM
RE: Table of Temperatures... Help - by zepel - May-07-2017, 07:56 AM
RE: Table of Temperatures... Help - by buran - May-07-2017, 08:02 AM
RE: Table of Temperatures... Help - by zepel - May-07-2017, 08:07 AM
RE: Table of Temperatures... Help - by buran - May-07-2017, 08:11 AM
RE: Table of Temperatures... Help - by zepel - May-07-2017, 08:19 AM
RE: Table of Temperatures... Help - by buran - May-07-2017, 08:27 AM
RE: Table of Temperatures... Help - by buran - May-07-2017, 08:33 AM
RE: Table of Temperatures... Help - by zepel - May-07-2017, 08:34 AM
RE: Table of Temperatures... Help - by buran - May-07-2017, 08:37 AM
RE: Table of Temperatures... Help - by zepel - May-07-2017, 08:41 AM
RE: Table of Temperatures... Help - by buran - May-07-2017, 08:41 AM
RE: Table of Temperatures... Help - by zepel - May-07-2017, 08:48 AM

Forum Jump:

User Panel Messages

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