# -*- coding: utf-8 -*-
"""
Created on Thu Mar 19 13:10:29 2026

@author: student
"""

def get_measurment():
    print("Podaj wartosc i jednostke temperatury")
    value1 = float(input("Podaj sama wartosc temperatury: "))
    unit1 = input("Podaj sama jednostke temperatury, F - Fahrenheit, C - Celcjusz: ")
    return value1, unit1
    
def convert_to_farenheit(value):
    return 32 + 9/5*value

def convert_to_celcius(value):
    to_return = (value - 32) * 5/9
    return to_return

value, unit = get_measurment()
#get_measurment()
#print(get_measurment())

def convert_temp(value, unit):
    if unit == 'C' or unit == 'c':
        temp = convert_to_farenheit(value)
    elif unit == 'F' or unit == 'f':
        temp = convert_to_celcius(value)
    else:
        print("Nieprawidłowa jednostka")
        temp = None
    return temp

def convert_temp_nw(value, unit):
    if unit == 'C' or unit == 'c':
        temp = convert_to_farenheit(value)
    else:
        temp = convert_to_celcius(value)
    return temp

def convert_temp2(value, unit):
    if unit == 'C' or unit == 'c':
        temp = convert_to_farenheit(value)
        x = 'Farenheit'
    elif unit == 'F' or unit == 'f':
        temp = convert_to_celcius(value)
        x = 'Celcius'
    else:
        #print("Nieprawidłowa jednostka")
        temp = None
        x = 'Bledna jednostka'
    return temp, x

temp, jednostka = convert_temp2(value, unit)
print("Przekonwertowana temperatura ", temp, jednostka)