MYTUTOR SUBJECT ANSWERS

89 views

Write a program that can convert between celcius and farenheit temperature scales

Fahrenheit to Celsius formula: (°F - 32) x 5/9 = °C or in plain english, First subtract 32, then multiply by 5, then divide by 9.

Celsius to Fahrenheit formula: (°C × 9/5) + 32 = °F or in plain English, Multiple by 9, then divide by 5, then add 32

---------------------------------------------- Convert Fahrenheit to Celsius -----------------------------

#!/usr/bin/env python

Fahrenheit = int(raw_input("Enter a temperature in Fahrenheit: "))

Celsius = (Fahrenheit - 32) * 5.0/9.0

print "Temperature:", Fahrenheit, "Fahrenheit = ", Celsius, " C"

------------------------------------------   Convert Celsius to Fahrenheit    -------------------------

#!/usr/bin/env python

Celsius = int(raw_input("Enter a temperature in Celsius: "))

Fahrenheit = 9.0/5.0 * Celsius + 32

print "Temperature:", Celsius, "Celsius = ", Fahrenheit, " F"

--------------------------------------------------

An example of an acceptable solution to the problem using 'int' and 'print' functions to take input transform it and then display an output

Matthew P. 11 Plus Maths tutor, GCSE Maths tutor, A Level Maths tutor...

3 months ago

Answered by Matthew, a Mentoring Python tutor with MyTutor

Still stuck? Get one-to-one help from a personally interviewed subject specialist

0 SUBJECT SPECIALISTS

About the author

Matthew P.

Currently unavailable: for new students

Degree: Electronic & Electrical Engineering (Bachelors) - Southampton University

Subjects offered: Python, Physics+ 1 more

Python
Physics
Maths
Electronics

“About me: I'm an undergarduate Electronic Engineer studying at the University of Southampton. I really enjoy working on new projects, such as designing robots and other rasberry pi projects, and it stems from a love of Physics and Mat...”

MyTutor guarantee

You may also like...

Posts by Matthew

Convert the decimal number 165 to binary

Explain the difference between forced vibration and resonance in an oscillating object.

find general solution to: x(dy/dx) + 2y = 4x^2

Find Solution to x^2 + x - 2=0

Other Mentoring Python questions

Write a program that can convert between celcius and farenheit temperature scales

How could I write a program to convert Km/h to m/s in python

View Mentoring Python tutors

Cookies:

We use cookies to improve our service. By continuing to use this website, we'll assume that you're OK with this. Dismiss

mtw:mercury1:status:ok