Question
Heating before the sauna in python This task is a bit smaller and should focus on methods. In the next task, you will use a
Heating before the sauna in python
This task is a bit smaller and should focus on methods. In the next task, you will use a method to test the temperature in Celsius and whether the temperature is right. The user types in a value that corresponds to the value for Fahrenheit.
The method you create must then be used to do this conversion.
The method that should be called "fahr_to_cel" thus needs to be able to receive arguments (the value in Celsius) but also be able to return a value (the value in Fahrenheit).
In this task, the following must then take place:
1. Request input of Fahrenheit by user. 2. Call the fahr_to_cel method with the fahrenheit argument 3. Convert the value in the method from Fahrenheit to Celsius 4. Return the value 5. Print the value in Celsius
Note that we only work with integers in this task.
To call a method, the code that follows is used. Then note that the method call sends with arguments (a value) and receives a return value from the method (another value). The number ("170") refers to an example value for Fahrenheit.
Python:
celsius = fahr_to_cel(170) print (celsius)
In this task, the challenge is that you must be able to follow the instructions and create a correct method call that includes an argument. Likewise, the method must return a correct value that is taken care of where the method was called.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started