Python Forum
Using a range and for loop - temp converter
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Using a range and for loop - temp converter
#4
you need to use the name from the loop in the calculations:

def main():
   print("This program computes and prints a table")
   print("of Celsius temperatures and the Fahrenheit equivalent")
   print("every 10 degrees from 0C to 100C")

   input("Press key to begin..."))

   for celsius in range (0, 101, 10):
       fahrenheit = 9/5 * celsius + 32
       print("The temperature is", fahrenheit, "degrees Fahrenheit.")

main()
Reply


Messages In This Thread
RE: Using a range and for loop - temp converter - by buran - Jan-20-2017, 06:41 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  My first temperature converter TheLowEndTheory 7 3,699 Oct-18-2020, 04:39 PM
Last Post: buran
  How can I run a function inside a loop every 24 values of the loop iteration range? mcva 1 2,215 Sep-18-2019, 04:50 PM
Last Post: buran
  Temperature converter Help (ASAP) Edison_Weng 1 2,928 Apr-16-2018, 01:55 PM
Last Post: stranac
  Debugging error, while loop out of range zenort 1 4,059 Feb-14-2018, 03:36 PM
Last Post: zenort
  Temp Converter with Kelvin vader33 7 12,472 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