Python Forum
Temp Converter with Kelvin
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Temp Converter with Kelvin
#4
Also, look at your input checking section. Note that this is a much easier way to do it:

badInput = True
while badInput:
    which = input('Enter selection: ')
    if which in ['F', 'C', 'K']:
        badInput = False
That reduces three conditions to one condition. But then, if you just have one condition, you can stick that condition in the while statement:


which = 'X'
while which not in ['F', 'C', 'K']:
    which = input('Enter selection: ')
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply


Messages In This Thread
Temp Converter with Kelvin - by vader33 - Oct-01-2016, 02:32 PM
RE: Temp Converter with Kelvin - by ichabod801 - Oct-01-2016, 02:41 PM
RE: Temp Converter with Kelvin - by vader33 - Oct-01-2016, 10:24 PM
RE: Temp Converter with Kelvin - by ichabod801 - Oct-01-2016, 02:46 PM
RE: Temp Converter with Kelvin - by ichabod801 - Oct-01-2016, 11:35 PM
RE: Temp Converter with Kelvin - by vader33 - Oct-02-2016, 05:16 AM
RE: Temp Converter with Kelvin - by Vexis - Oct-02-2016, 03:39 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  My first temperature converter TheLowEndTheory 7 3,559 Oct-18-2020, 04:39 PM
Last Post: buran
  Temperature converter Help (ASAP) Edison_Weng 1 2,850 Apr-16-2018, 01:55 PM
Last Post: stranac
  Using a range and for loop - temp converter rattlerskin 5 15,801 Jan-20-2017, 09:15 PM
Last Post: sparkz_alot

Forum Jump:

User Panel Messages

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