Open roberthsu2003 opened 4 weeks ago
import math
side = float(input("請輸入對邊:"))
another_side = float(input("請輸入斜邊:"))
radian = math.asin(side / another_side)
degree = math.degrees(radian)
print(f'角度是:{round(degree,ndigits=2)}')
print("公斤轉換為磅")
kilograms = float(input("請輸入公斤:"))
pounds = kilograms * 2.20426
print(f"{kilograms}公斤={pounds:.3f}磅")
print("磅轉換為公斤")
pounds = float(input("請輸入磅:"))
kilograms = pounds / 2.20426
print(f"{pounds}磅 = {kilograms:.3f}公斤")
# 公斤轉換為磅
kilograms = float(input("請輸入公斤:"))
pounds = 2.20426 * kilograms
print(f'{kilograms} 公斤 = {pounds:.2f} 磅')
# 磅轉換為公斤
pounds = float(input("請輸入磅:"))
kilograms = pounds / 2.20426
print(f'{pounds} 磅 = {kilograms:.2f} 公斤')
kilograms = float(input('請輸入公斤:'))
pounds = kilograms * 2.20426
print(f'{kilograms}公斤 = {round(pounds,ndigits=2)}磅')
pounds = float(input('請輸入磅:'))
kilograms = pounds / 2.20426
print(f'{pounds}磅 = {round(kilograms,ndigits=2)}公斤')
kilo=float(input("輸入公斤:"))
pounds=kilo*2.20426
print(f"公斤:{kilo}=磅:{pounds:.2f}")
pounds=float(input("輸入幾磅:"))
kilo=pounds/2.20426
print(f"磅:{pounds}=公斤:{kilo:.2f}")
# 1公斤=2.20426磅
# kilograms,pounds
print("公斤轉換為磅")
kilograms = float(input("請輸入公斤"))
pounds = kilograms * 2.20426
print(f"{kilograms}公斤 = {pounds:.4f}磅")
print("")
print("磅轉換為公斤")
pounds = float(input("請輸入磅"))
kilograms = pounds / 2.20426
print(f"{pounds}磅 = {kilograms:.4f}公斤")
print('公斤轉換為磅')
kilograms = float(input("請輸入公斤:"))
pounds = kilograms * 2.20426
print(f'請輸入公斤:{kilograms}')
print(f'{kilograms}公斤 = {round(pounds , ndigits=2)}磅')
print('磅轉換為公斤')
pounds = float(input("請輸入磅:"))
kilograms = pounds / 2.20426
print(f'請輸入磅:{pounds}')
print(f'{pounds}磅 = {round(kilograms , ndigits=2)}公斤')
## 公斤轉成磅
KILLO_TO_POUND=2.20426
print('我幫你公斤轉成磅')
kilograms=float(input('你幾公斤?'))
print(f'{kilograms}公斤的你')
result=kilograms * KILLO_TO_POUND
print(f'有{result:.2f}磅')
## 磅轉成公斤
print("磅轉成公斤")
pounds=float(input('你幾磅?'))
print(f'{pounds}磅的你')
result2=pounds/KILLO_TO_POUND
print(f'有{result2:.2f}公斤')
""" 1公斤=2.20426磅 kilograms,pounds """ kilograms = float(input("請輸入多少公斤")) pounds = kilograms * 2.20426 print(f"{kilograms}公斤 = {pounds:.2f}磅")
pounds = float(input("請輸入多少磅")) kilograms = pounds / 2.20426
print(f"{pounds}磅等於 {round(kilograms,3)}公斤")
kilo=float(input("幾公斤"))
po=kilo*2.20426
print(f"{kilo}公斤={po:.2f}磅")
po=float(input("幾磅"))
kilo=po/2.20426
print(f"{po}磅={kilo:.2f}公斤")
a= float (input("請輸入一個公斤數")) pounds = a * 2.20426 print (f'{a}公斤={round (pounds,ndigits=2)}磅')
b= float (input("請輸入一個磅數")) kilograms = b / 2.20426 print (f'{b} 磅={round (kilograms,ndigits=2)}公斤')
print("公斤轉換為磅")
kilograms = float(input("請輸入公斤:"))
pounds = kilograms * 2.20426
print(f'{kilograms}公斤 = {pounds:.2f}磅')
print("磅轉換為公斤")
pounds = float(input("請輸入磅:"))
kilograms = pounds / 2.20426
print(f'{pounds}磅 = {kilograms:.2f}公斤')
#公斤轉換為磅
kilograms = float(input('請輸入公斤:'))
pounds = kilograms * 2.20426
print(f'{kilograms}公斤 = {round(pounds,ndigits=2)}磅')
#磅轉換為公斤
pounds = float(input('請輸入磅:'))
kilograms = pounds / 2.20426
print(f'{pounds}磅 = {round(kilograms,ndigits=2)}公斤')
print("This helps you transform kiolgrams and pounds")
K=float(input('Please input Kilograms'))
K2=2.20426*K
print(f'{K}Kilograms={K2:.4f}pounds')
P=float(input('Please input pounds'))
P2=P/2.20426
print(f'{P}pounds={P2:.4f}Kilograms')
kilograms = float(input("請輸入公斤:")) pounds = 2.20426 * kilograms print(f'{kilograms} 公斤 = {pounds:.2f} 磅')
pounds = float(input("請輸入磅:")) kilograms = pounds / 2.20426 print(f'{pounds} 磅 = {kilograms:.2f} 公斤')
KGTOP = 2.20426 n = int(input("請輸入1(公斤轉磅)或是2(磅轉公斤): "))
if n == 1: print("公斤轉換為磅") kilograms = float(input("請輸入公斤: ")) pounds = kilograms * KGTOP print(f"{kilograms}公斤 = {pounds:.3f}磅") elif n == 2: print("磅轉換為公斤") pounds = float(input("請輸入磅: ")) kilograms = pounds / KGTOP print(f"{pounds}磅 = {kilograms:.3f}公斤") else: print("錯誤,請輸入1或2")
公斤和磅的轉換