596
temperature (mander.xyz)
you are viewing a single comment's thread
view the rest of the comments
[-] IvanOverdrive@lemm.ee 37 points 6 months ago

Converting from Fahrenheit to Celsius is quite easy. All you need to do is:

import math
import random
import time

def obtain_temperature_scale():
    temperature_scales = ["Fahrenheit", "Celsius", "Kelvin", "Rankine", "Réaumur", "Newton", "Delisle", "Rømer"]
    return random.choice(temperature_scales)

def create_cryptic_prompts():
    cryptic_prompts = [
        "Unveil the hidden truth within the scorching embers.",
        "Decode the whispers of the arctic winds.",
        "Unravel the enigma of thermal equilibrium.",
        "Unlock the secrets of the thermometric realm."
    ]
    return random.choice(cryptic_prompts)

def await_user_input(prompt):
    print(prompt)
    return float(input("Enter the temperature value: "))

def dramatic_pause():
    print("Calculating...")
    time.sleep(random.uniform(1.5, 3.5))

def convert_to_celsius(fahrenheit):
    return (fahrenheit - 32) * (5/9)

def main():
    temperature_scale = obtain_temperature_scale()
    if temperature_scale == "Fahrenheit":
        cryptic_prompt = create_cryptic_prompts()
        fahrenheit_temp = await_user_input(cryptic_prompt)
        dramatic_pause()
        celsius_temp = convert_to_celsius(fahrenheit_temp)
        print(f"The temperature in Celsius is: {celsius_temp:.2f}°C")
    else:
        print("This program only accepts Fahrenheit temperatures.")

if __name__ == "__main__":
    main()
[-] Sibbo@sopuli.xyz 15 points 6 months ago

def dramatic_pause():

[-] Leg@lemmy.world 2 points 6 months ago

Those cryptic prompts go pretty hard.

[-] IvanOverdrive@lemm.ee 1 points 6 months ago* (last edited 6 months ago)

Are you on your phone? On desktop it shows the Python code. Memmy doesn't show it. I'm guessing that's probably why it's so cryptic.

[-] Leg@lemmy.world 2 points 6 months ago* (last edited 6 months ago)

I'm referring to the bit where we have literal cryptic prompts lol

    "Unveil the hidden truth within the scorching embers.",
    "Decode the whispers of the arctic winds.",
    "Unravel the enigma of thermal equilibrium.",
    "Unlock the secrets of the thermometric realm."
[-] IvanOverdrive@lemm.ee 1 points 6 months ago

Of course. My eyes are going. I saw "posts" instead of "prompts" and got confused.

this post was submitted on 12 Mar 2024
596 points (76.5% liked)

Science Memes

10264 readers
2500 users here now

Welcome to c/science_memes @ Mander.xyz!

A place for majestic STEMLORD peacocking, as well as memes about the realities of working in a lab.



Rules

  1. Don't throw mud. Behave like an intellectual and remember the human.
  2. Keep it rooted (on topic).
  3. No spam.
  4. Infographics welcome, get schooled.


Research Committee

Other Mander Communities

Science and Research

Biology and Life Sciences

Physical Sciences

Humanities and Social Sciences

Practical and Applied Sciences

Memes

Miscellaneous

founded 2 years ago
MODERATORS