一、
ex19_1.py
# this is ex19's excrist
def Burst_price(user_name, basic_pay, performance_pay, performance_score):
print(f"Hi,{user_name}")
print(f"Your basic pay is {basic_pay} $.")
print(f"And performance pay is {performance_pay} $.")
print(f"This month your performance score is {performance_score}.")
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 {score}. \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 $