CD2021 40823139

  • Home
    • Site Map
    • reveal
    • blog
  • Stage-1
    • 最終結果
    • 問題檢討
      • 最佳化設計
      • 模擬的碰撞問題
      • 機構模型過於理想
      • 時間裕度
    • week2
    • week3
    • week4
  • Stage-2
    • week6
    • week7
    • week8
    • week9
  • Stage-3
    • 模型簡化
    • W16 exam
    • W13~W14
      • 翻譯
      • Pick and Place
    • task1
      • 獲得正確順序(沒嵌入網站)
      • 嵌入網站
    • task2
    • task3
  • 機器人學
    • 正向運動學
    • 逆向運動學
  • Program
    • 基礎Python
      • package-example
      • geometry
      • funtion-args
      • funtion-basic
      • loop-basic
      • loop-control
      • module
      • number-string
      • set-dictionary
      • start
      • datatype
      • condition
      • list-tuple
  • About
  • 學期總結
  • CMSiMDE
    • 基本操作
      • 編輯網頁內容
      • 上傳與引用檔案
      • 上傳與引用圖片
      • 嵌入程式碼
      • 嵌入影片檔
      • 檢視 STL
    • Gitlab 同步
    • Heroku 部署
    • Fossil SCM
  • 建立網頁
  • 網站錯誤
    • 標題選擇
    • 靜態網頁 404
    • 動態網站錯誤
    • 出現ValueError
  • 延伸開發
module << Previous Next >> set-dictionary

number-string

# 數字運算
x=3+6
print(x)

x=3-6
print(x)

x=3*6
print(x)

x=3/6
print(x)

x=3//6
print(x)
#小數除法
x=3/7
print(x)
#整數除法

x=2**3
print(x)
#表次方
x=2**0.5
print(x)
#用次方做開根號
x=7%3
print(x)
#求餘數
x=2+3
print(x)

x+=1 
print(x)
x-=1 
print(x)
#與C的+= -= *= /=概念都一樣

# 字串運算
s="Hello"
print(s)

s='Hello'
print(s)
#字串用"" 或 ''都可以 ,但要注意內外層邏輯
s="Hell\"o"
print(s)
#\表示跳脫
s="Hello"+"World"
print(s)

s="Hello\nWorld"
print(s)

s="""Hello


World"""
print(s)
#python限定,三個"""可以做直接換行
s="Hello"*3+"World"
print(s)
#字串運算依然照先乘除後加減

# 字串會對內部的字元編號(索引),0 開始算起
s="Hello"
print(s[0])
print(s[1])
print(s[2])
#印出第n個字元
print(s[1:4])
#從編號1的字元印到編號4的字元
print(s[:4])
#從一開始印到編號四的字元,注意第一個是0開始
print(s[1:])
#從編號1的字元印到最後
x = ("love"+'you'+' ')*3
print(x)


module << Previous Next >> set-dictionary

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