一、
ex19_1.py
# this is ex19's excrist
def burst_price(user_name, basic_pay, performance_pay, performance_score):
print(f"hi,")
print(f"your basic pay is $.")
print(f"and performance pay is $.")
print(f"this month your performance score is .")
print(f"so the month your pay is", basic_pay + performance_pay * performance_score/10, "$")
burst_price("xiaoming", 3000, 5000, 8)
print("-" * 30)
print("hi, can i ask you some question?")
print("please hit return to countinue, or ctrl-c to stop")
input("?")
score = 7.7
name = input("what's your name?")
basic = int(input("how much your basic?"))
performance = int(input("how nuch your performance?"))
print(f"ok, this month your performance_score is . \n so" )
burst_price(name, basic, performance, score)
遇到的問題:
print(f""),f代表字串,在合計工資總數是按照上面的型別寫在了{}中。系統報錯
typeerror: unsupported operand type(s) for *: 'set' and 'set'
之後,寫在「」外畫蛇添足的 int()形式。
二 本地函式的呼叫。
test_19_1.py
from ex19_1 import burst_price
burst_price("lily", 5000, 2000, 5.5)
執行結果:
hi,xiaoming
your basic pay is 3000 $.
and performance pay is 5000 $.
this month your performance score is 8.
so the month your pay is 7000.0 $
hi,lily
your basic pay is 5000 $.
and performance pay is 2000 $.
this month your performance score is 5.5.
so the month your pay is 6100.0 $
ex35 分支和函式
建立無限迴圈 next input if next take honey dead the bear looks at you then slaps your face off.elif next taunt bear andnot bear moved print the bear has mov...
物件和變數,函式
1 物件 所有資料型別 數字 字串 都是物件 2 變數 1 定義 給物件起了乙個名字,通過名字訪問物件 如a 1 a是變數 1是物件 2 命名規則 大小寫開頭,開頭不允許數字或空格,中間用下劃線 或數字 3 變數的賦值 name zhang san name li si 命名空間有乙個name它首先...
函式整理(變數和轉換函式)
函式整理 變數和轉換函式 直接處理變數型別並提供變數型別之間相關轉換的方法。cbool cbool函式根據引數值返回boolean值。用法為 result cbool expr 其中result是屬於boolean子類variant的表示式,expr是可計算出數值的有效表示式。如果expr為0,則返...