File tree 2 files changed +9
-7
lines changed 2 files changed +9
-7
lines changed Original file line number Diff line number Diff line change 1
1
""" Convert temperature from Celsius to Fahrenheit """
2
2
3
+
3
4
def celsius_to_fahrenheit (celsius ):
4
5
"""
5
6
Convert a given value from Celsius to Fahrenheit
@@ -26,9 +27,10 @@ def celsius_to_fahrenheit(celsius):
26
27
"""
27
28
raise TypeError ("'str' object cannot be interpreted as integer" )
28
29
29
- fahrenheit = (celsius * 9 / 5 ) + 32 # value converted from celsius to fahrenheit
30
+ fahrenheit = (celsius * 9 / 5 ) + 32 # value converted from celsius to fahrenheit
30
31
print (fahrenheit )
31
32
33
+
32
34
if __name__ == "__main__" :
33
35
import doctest
34
- doctest .testmod ()
36
+ doctest .testmod ()
Original file line number Diff line number Diff line change 1
1
""" Convert temperature from Fahrenheit to Celsius """
2
2
3
+
3
4
def fahrenheit_to_celsius (fahrenheit ):
4
5
"""
5
6
Convert a given value from Fahrenheit to Celsius and round it to 2 d.p.
@@ -27,13 +28,12 @@ def fahrenheit_to_celsius(fahrenheit):
27
28
"""
28
29
raise TypeError ("'str' object cannot be interpreted as integer" )
29
30
30
-
31
- celsius = (fahrenheit - 32 )* 5 / 9 # value converted from fahrenheit to celsius
32
- celsius = round (celsius , 2 )
31
+ celsius = (fahrenheit - 32 ) * 5 / 9 # value converted from fahrenheit to celsius
32
+ celsius = round (celsius , 2 )
33
33
# converted (celsius) value is rounded to two decimal places
34
34
print (celsius )
35
35
36
+
36
37
if __name__ == "__main__" :
37
38
import doctest
38
- doctest .testmod ()
39
-
39
+ doctest .testmod ()
You can’t perform that action at this time.
0 commit comments