"""
用于计算公司员工的薪资
"""
company = "zzlg"
def yesrSalary(monthSalary):
"""根据传入的月薪,计算出年薪:monthsalary*12"""
return monthSalary*12
def daySalary(monthSalary):
"""根据传入的月薪,计算出日薪,一个月按照22.5天计算"""
return monthSalary/22.5
#测试
if __name__ == "__main__":
print(yesrSalary(5000))
PyDev console: starting.
Python 3.11.0 (main, Oct 24 2022, 18:26:48) [MSC v.1933 64 bit (AMD64)] on win32
import math
id(math)
1411984909120
type(math)
<class 'module'>
import math
import math,turtle
id(math)
1411984909120
import math as m
id
<built-in function id>
id(m)
1411984909120
from math import pi,sin
sin(3.14)
0.0015926529164868282
s= "math"
m = __import__(s)
m.pi
3.141592653589793
推荐使用下面这种
import importlib
a = importlib.import_module(s)
a.pi
3.141592653589793
import test02
import test02
print("#####")
import importlib
importlib.reload(test02)
# import a.aa.module_AA
# a.aa.module_AA.fun_AA()
#
# from a.aa import module_AA
# module_AA.fun_AA()
from a.aa.module_AA import fun_AA
fun_AA()
import a
print(a.math.pi)
import sys
# sys.path.append("d:/")
print(sys.path)
import sys
sys.path.append("d:/")
print(sys.path)
python课程完成 接下来进入算法。