Skip to content

Conversation

@May6eSix
Copy link

No description provided.

fah = (9/5 * cel) +32
return fah


Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Код не завершений. Саму ж програму я б написав так:
import re
while True:

def kelv2cel(kelv):
    while kelv>0:
        cel=kelv-273,15
        return cel
    else:
        return False

def cel2kelv(cel):
    while cel>-273.15:
        kelv=cel+273.15
        return kelv
    else:
        return False

def fah2kelv(fah):
    while kelv>0:
        kelv=fah/1.8 + 273.15
        return kelv
    else:
        return False

def kelv2fah(kelv):
    fah=1.8*kelv-459.67
    return fah
def fah2cel(fah):
    cel = 5*(fah - 32) / 9
    return cel
def cel2fah(cel):
    fah = (9/5 * cel) +32
    return fah
def do_input_1to3(message):
    flag = True
    while flag:
        value = input(message)
        if bool(re.match('^[1-3]{1,}$', value)):
            flag = False
            value = int(value)
        else:
            print('error')
    return value
choice=do_input_1to3("Виберіть як ви хочете змінити градуси:1(С° в К° та F°);2(K° в C° та F°);3(F° в К° та C°):")
if choice==1:
    cel=float(input("Введіть значення в Цельсіях:"))
    print("Значення в Кельвінах та Фарангейтах:",cel2kelv(cel),cel2fah(cel))
if choice==2:
    kelv=float(input("Введіть значення в Кельвінах:"))
    print("Значення в Цельсіях та Фарангейтах:",kelv2cel(kelv),kelv2fah(kelv))
if choice==3:
    fah = float(input("Введіть значення в Фарангейтах:"))
    print("Значення в Кельвінах та Цельсіях:",fah2kelv(fah), fah2cel(fah))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants