Konverterings-program

Skip to content

This doth be a machine-wrought text which may contain errors!

Vanskelighetsgrad: Medium

In this task, thou shalt craft a programme that doth convert betwixt Celsius and Fahrenheit.

  • First, the programme shall inquire whether to convert to Fahrenheit or to Celsius.
  • Thereafter, the user shall be asked to input a number. 🔢
  • Create two functions within the code:
    • 🌡️ The one shall convert the number from Celsius to Fahrenheit.
    • 🌡️ The other shall convert the number from Fahrenheit to Celsius.
  • Based upon that which the user did request, convert the temperature and give the answer unto the user!

Hint!: Konverteringsformler

🌡️ The formula to transmute from Celsius to Fahrenheit doth be:

fahrenheit = (celsius * 9 / 5) + 32

🌡️ The formula to transmute from Fahrenheit to Celsius doth be:

celsius = (fahrenheit - 32) * 5 / 9

Hark! An Addition!

  • Pray, let the programme possess a more ample “menu” of conversion, wherein thou mayest elect to convert betwixt:
    • Temperature (as afore was wont)
    • Distance
    • Volume

```markdown

[!EXAMPLE]- Instances of Formulations:

```python

mile = km / 1.609344

Miles to Kilometres

km = mile * 1.609344

Litres to Gallons

liter = gallon * 4.54609

Gallons to Litres

gallon = liter / 4.54609
```

Light-Years to Kilometres

lightyears = kilometer / 9460730472580.8
```