Last active
June 9, 2017 06:29
-
-
Save doraiso/4689858df91b1b75e125a750e3a01478 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 台形の面積コマンドライン入力から求める | |
# 上辺とか下辺が同じであればメッセージを変更する | |
DAIKEI = "台形" | |
HEIHOU = "平方四辺形" | |
a = float(input("上辺? ")) | |
b = float(input("下辺? ")) | |
h = float(input("高さ? ")) | |
daikei = (a + b) * h / 2 | |
if a == b: | |
str = HEIHOU | |
print("それ平行四辺形じゃね?") | |
else: | |
str = DAIKEI | |
# 結果を表示 | |
print(str,"の面積は", daikei, "cm2") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment