CopyAssignment

We are Python language experts, a community to solve Python problems, we are a 1.2 Million community on Instagram, now here to help with our blogs.

  • Temperature Conversion in Python

Today, we will see how to do temperature conversion in Python. We will convert from one unit of temperature to other units of temperature in Python. We will ask the user to enter the temperature. We will consider the input temperature’s to be celsius and we will convert them to the other two units of temperature i.e. Fahrenheit and Kelvin.

The formula for converting Celsius to Fahrenheit is celsius * (9/5) + 32

The formula for converting Celsius to Kelvin is celsius + 273.15 .

Code for Temperature Conversion in Python

Temperature Conversion in Python | Assignment Expert

  • Hyphenate Letters in Python
  • Earthquake in Python | Easy Calculation
  • Striped Rectangle in Python
  • Perpendicular Words in Python
  • Free shipping in Python
  • Raj has ordered two electronic items Python | Assignment Expert
  • Team Points in Python
  • Ticket selling in Cricket Stadium using Python | Assignment Expert
  • Split the sentence in Python
  • String Slicing in JavaScript
  • First and Last Digits in Python | Assignment Expert
  • List Indexing in Python
  • Date Format in Python | Assignment Expert
  • New Year Countdown in Python
  • Add Two Polynomials in Python
  • Sum of even numbers in Python | Assignment Expert
  • Evens and Odds in Python
  • A Game of Letters in Python
  • Sum of non-primes in Python
  • Smallest Missing Number in Python
  • String Rotation in Python
  • Secret Message in Python
  • Word Mix in Python
  • Single Digit Number in Python
  • Shift Numbers in Python | Assignment Expert
  • Weekend in Python
  • Special Characters in Python
  • Sum of Prime Numbers in the Input in Python

' src=

Author: Harry

temperature conversion assignment expert

Search….

temperature conversion assignment expert

Machine Learning

Data Structures and Algorithms(Python)

Python Turtle

Games with Python

All Blogs On-Site

Python Compiler(Interpreter)

Online Java Editor

Online C++ Editor

Online C Editor

All Editors

Services(Freelancing)

Recent Posts

  • Most Underrated Database Trick | Life-Saving SQL Command
  • Python List Methods
  • Top 5 Free HTML Resume Templates in 2024 | With Source Code
  • How to See Connected Wi-Fi Passwords in Windows?
  • 2023 Merry Christmas using Python Turtle

© Copyright 2019-2024 www.copyassignment.com. All rights reserved. Developed by copyassignment

  • Contact Searching

Temperature Conversion ¶

Project goals ¶.

This programming project invites you to combine what you learned about the basics of Python programming to implement a useful program that converts a temperature value between two different measurement scales, Celsius and Fahrenheit. The program inputs the temperature reading that it should convert and a configuration explaining whether it should convert from Celsius to Fahrenheit or from Fahrenheit to Celsius. Using these inputs the program performs the conversion and outputs it in the terminal. Along with adding documentation to the provided source code, you will create your own Python functions that uses both assignment statements and conditional logic to implement a correct program that passes the test suite and all of the checks. As you enhance your technical skills , you will program with tools such as VS Code and a terminal window and the Python programming language and the Poetry package manager.

Project Access ¶

If you are a student enrolled in a Computer Science class at Allegheny College, you can access this assignment by clicking the link provided to you in Discord. Once you click this link it will create a GitHub repository that you can clone to your computer by following the general-purpose instructions in the description of the technical skills . Specifically, you will need to use the git clone command to download the project from GitHub to your computer. Now you are ready to add source code and documentation to the project!

Expected Output ¶

This project invites you to implement a number comparison program called converter . The program accepts through its command-line a file that contains integer values encoded as text. If you run the program with the command poetry run converter --from-unit Celsius --to-unit Fahrenheit --temperature 22 it produces this output:

Since the program can also convert from Fahrenheit to Celsius, you can also run it with the command poetry run converter --from-unit Fahrenheit --to-unit Celsius --temperature 71.6 and see that it produces the following output:

One way in which you can tell that converter is working correctly is that, when given "inverse numbers", the output shows that it converts correctly in both "directions". For instance, converting 22 degrees Celsius to Fahrenheit yields 71.6 degrees and converting 71.6 degrees Fahrenheit to Celsius results in 22 degrees! To learn more about how to run this program, you can type the command poetry run converter --help to see the following output showing how to use converter :

Please note that the provided source code does not contain all of the functionality to produce this output. As explained in the next section, you are invited to add all of the missing features to ensure that converter produces the expected output. Once you finish the program, it should produce all of the expected output described in this section.

Recall that if you want to run the converter program you must use your terminal window to first go into the GitHub repository containing this project and then go into the converter directory that contains the project's source code. Remember that before running the program you must run poetry install to add the dependencies!

Adding Functionality ¶

If you study the file called converter/converter/main.py you will see that it has many TODO markers that designate the parts of the program that you need to implement before converter will produce correct output. Along with adding requested source code to the main module, you should implement the following functions in the convert module:

  • def convert_celsius_to_fahrenheit(temperature: float) -> float
  • def convert_fahrenheit_to_celsius(temperature: float) -> float
  • def convert_temperature(temperature: float, from_unit: units.TemperatureUnitOfMeasurement, to_unit: units.TemperatureUnitOfMeasurement)

The first two functions in this listing input a float value that respectively represents a temperature in Celsius or Fahrenheit and then converts it to a float representing a respective temperature in Fahrenheit or Celsius. Finally, the converted_temperature function uses source code as in the following segment to first determine what type of temperature conversion the user requested and then call the appropriate function. For instance, lines 3 and 4 show that, when the requested temperature conversion is from Celsius to Fahrenheit, the converted_temperature function will call the convert_celsius_to_fahrenheit function. Alternatively, lines 6 through 7 show that convert_temperature calls convert_fahrenheit_to_celsius when a person requests temperature conversion in the opposite direction.

1 2 3 4 5 6 7 8 = 0 # the requested temperature conversion is Celsius --> Fahrenheit if from_unit.value == "Celsius" and to_unit.value == "Fahrenheit": converted_temperature = convert_celsius_to_fahrenheit(temperature) # the requested temperature conversion is Fahrenheit --> Celsius elif from_unit.value == "Fahrenheit" and to_unit.value == "Celsius": converted_temperature = convert_fahrenheit_to_celsius(temperature) return converted_temperature

Once you have correctly resolved all of the TODO markers in converter , it should produce the expected output described in the previous section. You can use the following equations to guide your implementation of the convert_fahrenheit_to_celsius and convert_celsius_to_fahrenheit functions. Knowing that these equations use \(C\) and \(F\) to respectively denote the temperature in Celsius and Fahrenheit, you can translate them into Python source code that correctly performs temperature conversion.

Running Checks ¶

If you study the source code in the pyproject.toml file you will see that it includes the following section that specifies different executable tasks like lint . If you are in the converter directory that contains the pyproject.toml file and the poetry.lock file, the tasks in this section make it easy to run commands like poetry run task lint to automatically run all of the linters designed to check the Python source code in your program and its test suite. You can also use the command poetry run task black to confirm that your source code adheres to the industry-standard format defined by the black tool. If it does not adhere to the standard then you can run the command poetry run task fixformat and it will automatically reformat the source code.

Along with running tasks like poetry run task lint , you can leverage the relevant instructions in the technical skills to run the command gatorgrade --config config/gatorgrade.yml to check your work. If your work meets the baseline requirements and adheres to the best practices that proactive programmers adopt you will see that all the checks pass when you run gatorgrade . You can study the config/gatorgrade.yml file in your repository to learn how the GatorGrade program runs GatorGrader to automatically check your program and technical writing.

If your program has all of the anticipated functionality, you can run the command poetry run task test and see that the test suite produces output like this:

The test_convert test suite contains test cases for all of the functions mentioned in the previous section. Even if the test cases for convert_fahrenheit_to_celsius and convert_celsius_to_fahrenheit pass as expected it is possible that those for convert_temperature make not if the way in which it calls the specific temperature conversion functions is not correct. When one or more test cases fail, make sure you check to see which ones are failing so that you can better know where to start the debugging process! The following test case shows how to test convert_temperature when lines 3 and 4 configure convert_temperature to convert from Celsius to Fahrenheit. After setting the input temperature to 0 on line 1 and calling the convert_temperature function on line 5 , the test case checks on line 6 that the conversion function produced the temperature value of 32 , failing the test if that is not the case.

1 2 3 4 5 6 test_convert_celsius_to_fahrenheit_wrapper(): temperature = 0 from_unit = units.TemperatureUnitOfMeasurement.celsius to_unit = units.TemperatureUnitOfMeasurement.fahrenheit converted_temperature = convert.convert_temperature(temperature, from_unit, to_unit) assert converted_temperature == 32

Don't forget that when you commit source code or technical writing to your GitHub repository for this project, it will trigger the run of a GitHub Actions workflow. If you are a student at Allegheny College, then running this workflow consumes build minutes for the course's organization! As such, you should only commit to your repository once you have made substantive changes to your project and you are ready to confirm its correctness. Before you commit to your repository, you can still run checks on your own computer by either using Poetry and GatorGrader.

Project Reflection ¶

Once you have finished all of the previous technical tasks, you can use a text editor to answer all of the questions in the writing/reflection.md file. For instance, you should provide the output of the Python program in a fenced code block and explain the meaning of the Python source code segments that you implemented and tested. Along with answering all the questions about your experiences with project, you should explain every function call that occurs when running the program with a command like poetry run converter --from-unit Fahrenheit --to-unit Celsius --temperature 71.6 .

Project Assessment ¶

Since this is a programming project, it is aligned with the applying and analyzing levels of Bloom's taxonomy . You can learn more about how a proactive programming expert will assess your work by examining the assessment strategy . From the start to the end of this project you may make an unlimited number of reattempts at submitting source code and technical writing that meet all aspects of the project's specification.

Before you finish all of the required deliverables required by this project is worth pausing to remember that the instructor will give advance feedback to any learner who requests it through GitHub and Discord at least 24 hours before the project's due date! Seriously, did you catch that? This policy means that you can have a thorough understanding of ways to improve your project before its final assessment! To learn more about this opportunity, please read the assessment strategy for this site.

Seeking Assistance ¶

Emerging proactive programmers who have questions about this project are invited to ask them in either the GitHub discussions forum or the Proactive Programmers Discord server . Before you ask your question, please read the advice concerning how to best participate in the Proactive Programmers community . If you find a mistake in this project, please describe it and propose a solution by creating an issue in the GitHub Issue Tracker .

  • How it works
  • Homework answers

Physics help

Answer to Question #221097 in Python for Dr Kiran Tummalapa

Temperature Conversion

You are given the temperature T of an object in one of Celsius, Fahrenheit, and Kelvin scales.

Write a program to print T in all scales viz Celsius, Fahrenheit, and Kelvin.

Formula to convert from Fahrenheit F to Celsius C is C = (F - 32) * 5 / 9.

Formula to convert from Kelvin K to Celsius C is C = K - 273.

Here "C", "F", "K" represent that the temperature scale is in Celsius, Fahrenheit and Kelvin scales respectively.

The input contains the temperature (a number) and the unit of the temperature scale (C, F, K) without any space.

The output contains temperature in Celsius, Fahrenheit and Kelvin scales in each line in the format similar to input and the value of the temperature is rounded to 2 decimal places.

The first line of the input contain a temperature Value in one of Celsius, Fahrenheit, and Kelvin scales.

For example, if the given temperature Value is 25C then Celsius value is 25.0C, Fahrenheit value is 77.0F, and Kelvin value is 298.0K.

Need a fast expert's response?

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS !

Leave a comment

Ask your question, related questions.

  • 1. The possible denominations of currency notes are 100, 50, 20 and 10. The amount A to be withdrawn is
  • 2. Product of Numbers from M to NThis Program name is Product of Numbers from M to N. Write a Python pr
  • 3. Sum of K powersThis Program name is Sum of K powers. Write a Python program to Sum of K powers, it h
  • 4. Find Power of NumberThis Program name is Find Power of Number. Write a Python program to Find Power
  • 5. Solid Right Angled Triangle - 2This Program name is Solid Right Angled Triangle - 2. Write a Python
  • 6. Solid Rectangle - 2This Program name is Solid Rectangle - 2. Write a Python program to Solid Rectang
  • 7. Product of the Given NumbersThis Program name is Product of the Given Numbers. Write a Python progra
  • Programming
  • Engineering

10 years of AssignmentExpert

Who Can Help Me with My Assignment

There are three certainties in this world: Death, Taxes and Homework Assignments. No matter where you study, and no matter…

How to finish assignment

How to Finish Assignments When You Can’t

Crunch time is coming, deadlines need to be met, essays need to be submitted, and tests should be studied for.…

Math Exams Study

How to Effectively Study for a Math Test

Numbers and figures are an essential part of our world, necessary for almost everything we do every day. As important…

temperature conversion assignment expert

Snapsolve any problem by taking a picture. Try it in the Numerade app?

COMMENTS

  1. Answer in Python for umesh #231923

    Python. Question #231923. Temperature Conversion. You are given the temperature T of an object in one of Celsius, Fahrenheit, and Kelvin scales. Write a program to print T in all scales viz Celsius, Fahrenheit, and Kelvin. Formula to convert from Fahrenheit F to Celsius C is C = (F - 32) * 5 / 9.Formula to convert from Kelvin K to Celsius C is ...

  2. Answer in Python for p #168142

    Question #168142. Temperature Conversion. You are given the temperature T of an object in one of Celsius, Fahrenheit, and Kelvin scales. Write a program to print T in all scales viz Celsius, Fahrenheit, and Kelvin. Formula to convert from Fahrenheit F to Celsius C is C = (F - 32) * 5 / 9. Formula to convert from Kelvin K to Celsius C is C = K ...

  3. Answer in Python for hemanth #164735

    Python. Question #164735. Temperature Conversion. You are given the temperature T of an object in one of Celsius, Fahrenheit, and Kelvin scales. Write a program to print T in all scales viz Celsius, Fahrenheit, and Kelvin. Formula to convert from Fahrenheit F to Celsius C is C = (F - 32) * 5 / 9.

  4. Temperature Conversion In Python

    We will consider the input temperature's to be celsius and we will convert them to the other two units of temperature i.e. Fahrenheit and Kelvin. The formula for converting Celsius to Fahrenheit is celsius * (9/5) + 32. The formula for converting Celsius to Kelvin is celsius + 273.15. Code for Temperature Conversion in Python

  5. Temperature Conversion Practice Flashcards

    Convert from 3200 K to °C. Convert from 344 K to °C. Convert from 9.11 K to °C. Convert from 405.22 K to °F. Convert from 0.223 K to °F. Convert from 16033 K to °F. Convert from 223.78 K to °F. Study with Quizlet and memorize flashcards containing terms like Write the formula for converting from °F to °C., Write the formula for ...

  6. Temperature Conversion

    The program accepts through its command-line a file that contains integer values encoded as text. If you run the program with the command poetry run converter --from-unit Celsius --to-unit Fahrenheit --temperature 22 it produces this output: 🧮 Converting from Celsius to Fahrenheit! 22.00 degrees in Celsius is 71.60 degrees in Fahrenheit.

  7. Solved Temperature Conversion Assignment Perform the

    Our expert help has broken down your problem into an easy-to-learn solution you can count on. Question: Temperature Conversion Assignment Perform the following conversions. Write your answers here. On a separate page, show (neatly!) all work in doing your calculations (Show at least one decimal): a. 50°C = _______°F f. 5°F = ______°C k. 17 ...

  8. Homework Assignment 2: Temperature Conversion

    Our expert help has broken down your problem into an easy-to-learn solution you can count on. See Answer See Answer See Answer done loading. Question: #### Homework Assignment 2: Temperature Conversion Tool**Scenario:** You are building a weather app that converts a temperature.**Task:** Create a tool that:* Prompts the user to enter a ...

  9. Solved Your assignment is to make a temperature conversion

    Your assignment is to make a temperature conversion program. Your program should have at a minimum the following functions: - Function fahrenheit that will return the Fahrenheit equivalent of a Celsius or Kelvin temperature. - Function celsius that will return the Celsius equivalent of a Fahrenheit or Kelvin temperature.

  10. Answer in Python for Dr Kiran Tummalapa #221097

    Answer to Question #221097 in Python for Dr Kiran Tummalapa. Temperature Conversion. You are given the temperature T of an object in one of Celsius, Fahrenheit, and Kelvin scales. Write a program to print T in all scales viz Celsius, Fahrenheit, and Kelvin. Formula to convert from Fahrenheit F to Celsius C is C = (F - 32) * 5 / 9.

  11. Assignment #1: Temperature Conversion Program You can convert

    Assignment #1: ARM Assembly Language Program for Temperature Conversion. You can convert temperatures from Celsius to Fahrenheit or from Fahrenheit to Celsius. Here are the two formulas for your reference: C = (5 * F - 32) / 9 F = (9 * C / 5) + 32. Write an ARM assembly language program named "convertF2CandC2F.s" that performs the following ...

  12. PDF CS193E: Assignment 1-A

    CS193E: Assignment 1-A Temperature Converter Due Date This assignment is due by 5:00 PM, April 13. Assignment This assignment requires some easy Objective-C programming and illustrates how objects that you create can be used inside Interface Builder. The goal of this assignment is to familiarize you with the Cocoa development tools and work-

  13. Temperature Conversion Assignment Perform the following conversions

    k. To convert Celsius to Kelvin, you can simply add 273.15 to the Celsius value. Plugging in the given value of 17°C: K = 17 + 273.15 K = 290.15K. l. To convert Celsius to Kelvin, add 273.15 to the Celsius value. Plugging in the given value of -73°C: K = -73 + 273.15 K = 200.15K. m. To convert Kelvin to Celsius, subtract 273.15 from the ...

  14. Solved For this assignment, you will create a temperature

    Question: For this assignment, you will create a temperature conversion application. Create function "celsius" that returns the Celsius equivalent of a Fahrenheit temperature using the formula C=5.0 / 9.0 * (F-32); Create function "fahrenheit" that returns the Fahrenheit equivalent of the Celsius temperature using the formula F= 9.0 / 5.0 * C + 32; You will also have

  15. PDF MATH for SCIENCE Temperature Conversions ~ Lesson Plan

    oC = 5(80- 32) = 26.7 oC oC = 5 (98.6- 32) = 37 oC 9 9. Math for Science: Temperature Conversions. Atlantic Union Conference Teacher Bulletin www.teacherbulletin.org Page 4 of 13. B. Celsius to Fahrenheit oF = 9 oC+ 32 5 1.

  16. write an assignment statement to convert temperature in degrees

    To convert temperature in degrees Fahrenheit to degrees Celsius, ... write an assignment statement to convert temperature in degrees fahrenheit to degrees celsius. the formula for this conversion is celsius = 5/9 (fahrenheit - 32). ... Find expert explanations for textbooks. check. View instant step-by-step math solutions.

  17. Solved Task: Let's say you get an assignment to develop a

    Computer Science questions and answers. Task: Let's say you get an assignment to develop a temperature converter application (as you may have done already in a previous assignment). You may want to convert temperatures from one unit of measurement to multiple others. A basic script, called kelvin_to_celsius.py, could only be used to do that ...

  18. Solved Assignment

    Assignment - Temperature Conversion Objective Build an online temperature converter to convert sets of Fahrenheit values entered to degrees Celsius. Please use both java script and HTML and css to work on this assignment Function Specification Each set of user input must be limited to 10 values or less. The program must only accept digits (0 to ...

  19. Solved Your assignment is to create a Temperature Conversion

    Your assignment is to create a Temperature Conversion app as described below.App RequirementsThe app should allow the user to select either Fahrenheit-to-Celsius or Celsius-to-Fahrenheitconversions. No other conversion selections should be allowed, and one conversion must beselected at any given time (no situation where no conversion is ...