s40723210 cad2019

  • Home
    • Site Map
    • reveal
    • blog
  • Weeks
    • Week2-5
    • Week6-9
    • Week10-14
      • Solidworks-history
      • NX-history
      • Inventor-history
      • Creo(ProE)-history
    • Week15-18
    • 期末報告
  • Notes
    • git基本指令
    • python基本語法
      • 練習-1
      • 練習-2
      • 練習-3
      • 練習-4
    • vi 與 vim 的指令整理
    • Dos 基本指令
    • SolveSpace的快捷鍵
    • Nx12快捷鍵
    • Video device
    • Q&A
  • Organize books
    • Space Modeling with SolidWorks and NX
    • NX 12 for Engineering Design
      • 第一章-簡介
      • 第二章-入門教學
      • 第三章-二維草圖
      • 第四章-三維建模
      • 第五章-基本草圖
      • 第六章-組配建模
      • 第七章-曲面建模
      • 第八章-有限元素分析
      • 第九章-程式編寫與模擬
  • CAD software
    • AutoCAD
    • Inventor
    • Solidworks
    • solvespace
    • NX
    • Onshape
    • Creo(ProE)
  • About
練習-2 << Previous Next >> 練習-4

練習-3

#判斷式if

1
2
3
4
if True:
   print("True 執行")
else:
   print("False 執行")

True 執行

1
2
3
4
if False:
   print("True 執行")
else:
   print("False 執行")

False 執行

1
2
3
4
5
6
7
8
x=input("請輸入數字︰") # 取得字串形式的使用者輸入
x=int(x) # 將字串型態轉換成數字型態
if x>200:
    print("大於 200")
elif x>100:
    print("大於 100,小於等於 200")
else:
    print("小於等於 100")

輸入42
小於等於 100
輸入150
大於 100,小於等於 200

#四則運算

1
2
3
4
5
6
7
8
9
10
11
12
13
n1=int(input("請輸入數字一︰"))
op=input("請輸入運算︰+, -, *, /:")
n2=int(input("請輸入數字二︰"))
if op=="+":
    print(n1+n2)
elif op=="-":
    print(n1-n2)
elif op=="*":
    print(n1*n2)
elif op=="/":
    print(n1/n2)
else:
    print("不支援的運算")

輸入84
輸入+
輸入55
139


練習-2 << Previous Next >> 練習-4

Copyright © All rights reserved | This template is made with by Colorlib